// paint background g.setColor( getBackground() ); g.fillRect( 0, 0, width, height ); // paint foreground g.setColor( getForeground() ); g.drawString( "hello", x, y );