How to create Background and Foreground Colors in Java

The javax.swing.JComponent.setBackground and javax.swing.JComponent.setForegroundmethods can be used to set background and foreground colors for a component. For example, the statements

cartbutton.setBackground(Color.black);
cartbutton.setForeground(Color.white);


set the background and foreground colors for the JButton object cartbutton.

No comments:

Post a Comment