1 7 8 package javax.swing.plaf.metal; 9 10 import java.awt.*; 11 import java.awt.event.*; 12 import javax.swing.*; 13 import javax.swing.plaf.*; 14 import javax.swing.border.*; 15 import java.io.Serializable ; 16 import javax.swing.plaf.basic.BasicComboBoxUI ; 17 18 19 26 public class MetalComboBoxIcon implements Icon, Serializable { 27 28 31 public void paintIcon(Component c, Graphics g, int x, int y){ 32 JComponent component = (JComponent)c; 33 int iconWidth = getIconWidth(); 34 35 g.translate( x, y ); 36 37 g.setColor( component.isEnabled() ? MetalLookAndFeel.getControlInfo() : MetalLookAndFeel.getControlShadow() ); 38 g.drawLine( 0, 0, iconWidth - 1, 0 ); 39 g.drawLine( 1, 1, 1 + (iconWidth - 3), 1 ); 40 g.drawLine( 2, 2, 2 + (iconWidth - 5), 2 ); 41 g.drawLine( 3, 3, 3 + (iconWidth - 7), 3 ); 42 g.drawLine( 4, 4, 4 + (iconWidth - 9), 4 ); 43 44 g.translate( -x, -y ); 45 } 46 47 50 public int getIconWidth() { return 10; } 51 52 55 public int getIconHeight() { return 5; } 56 57 } 58 | Popular Tags |