1. /*
  2. * @(#)MetalComboBoxIcon.java 1.9 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.plaf.metal;
  11. import java.awt.*;
  12. import java.awt.event.*;
  13. import javax.swing.*;
  14. import javax.swing.plaf.*;
  15. import javax.swing.border.*;
  16. import java.io.Serializable;
  17. import javax.swing.plaf.basic.BasicComboBoxUI;
  18. /**
  19. * This utility class draws the horizontal bars which indicate a MetalComboBox
  20. *
  21. * @see MetalComboBoxUI
  22. * @version 1.9 02/02/00
  23. * @author Tom Santos
  24. */
  25. public class MetalComboBoxIcon implements Icon, Serializable {
  26. /**
  27. * Paints the horizontal bars for the
  28. */
  29. public void paintIcon(Component c, Graphics g, int x, int y){
  30. JComponent component = (JComponent)c;
  31. int iconWidth = getIconWidth();
  32. g.translate( x, y );
  33. g.setColor( component.isEnabled() ? MetalLookAndFeel.getControlInfo() : MetalLookAndFeel.getControlShadow() );
  34. g.drawLine( 0, 0, iconWidth - 1, 0 );
  35. g.drawLine( 1, 1, 1 + (iconWidth - 3), 1 );
  36. g.drawLine( 2, 2, 2 + (iconWidth - 5), 2 );
  37. g.drawLine( 3, 3, 3 + (iconWidth - 7), 3 );
  38. g.drawLine( 4, 4, 4 + (iconWidth - 9), 4 );
  39. g.translate( -x, -y );
  40. }
  41. /**
  42. * stubbed to statify the interface.
  43. */
  44. public int getIconWidth() { return 10; }
  45. /**
  46. * stubbed to statify the interface.
  47. */
  48. public int getIconHeight() { return 5; }
  49. }