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.
Home
Background and Foreground Colors
Developing GUIs
How to create Background and Foreground Colors in Java
How to create Background and Foreground Colors in Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment