public void paintIcon(Component c,
Graphics g,
int x,
int y) {
g.translate( x, y );
// Draw the frame
if ( c.hasFocus() ) {
g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
}
else {
g.setColor( c.isEnabled() ? MetalLookAndFeel.getPrimaryControlInfo() :
MetalLookAndFeel.getControlDarkShadow() );
}
g.drawLine( 1,0 , 13,0 ); // top
g.drawLine( 0,1 , 0,8 ); // left
g.drawLine( 14,1 , 14,8 ); // right
g.drawLine( 1,9 , 7,15 ); // left slant
g.drawLine( 7,15 , 14,8 ); // right slant
// Fill in the background
if ( c.hasFocus() ) {
g.setColor( c.getForeground() );
}
else {
g.setColor( MetalLookAndFeel.getControl() );
}
g.fillRect( 1,1, 13, 8 );
g.drawLine( 2,9 , 12,9 );
g.drawLine( 3,10 , 11,10 );
g.drawLine( 4,11 , 10,11 );
g.drawLine( 5,12 , 9,12 );
g.drawLine( 6,13 , 8,13 );
g.drawLine( 7,14 , 7,14 );
// Draw the bumps
if ( c.isEnabled() ) {
if ( c.hasFocus() ) {
primaryBumps.paintIcon( c, g, 2, 2 );
}
else {
controlBumps.paintIcon( c, g, 2, 2 );
}
}
// Draw the highlight
if ( c.isEnabled() ) {
g.setColor( c.hasFocus() ? MetalLookAndFeel.getPrimaryControl()
: MetalLookAndFeel.getControlHighlight() );
g.drawLine( 1, 1, 13, 1 );
g.drawLine( 1, 1, 1, 8 );
}
g.translate( -x, -y );
}
|