setBackground : Java Glossary
setBackground( 0xrrggbb ) sets the background
colour of a component the next time it is painted. setForeground sets the colour of text painted on it. Note it is
setBackground not setBackGround.
- When you use Swing, use contentPane.setBackground not
or nothing will happen.
- In a paintComponent method, you use Color c = getBackground(); graphics. setColor( c ); to load up the pen with
colour to paint the background. Doing a plain setBackground has no effect.
- Sometimes buttons in some L&Fs will ignore your setBackground. In that case
use setContentAreaFilled( false ) then paint your own background in paintComponent.