1. /*
  2. * @(#)MetalPopupMenuSeparatorUI.java 1.4 01/11/29
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.metal;
  8. import javax.swing.*;
  9. import java.awt.Color;
  10. import java.awt.Dimension;
  11. import java.awt.Graphics;
  12. import java.awt.Insets;
  13. import java.awt.Rectangle;
  14. import javax.swing.plaf.*;
  15. /**
  16. * A Metal L&F implementation of PopupMenuSeparatorUI. This implementation
  17. * is a "combined" view/controller.
  18. *
  19. * @version 1.4 11/29/01
  20. * @author Jeff Shapiro
  21. */
  22. public class MetalPopupMenuSeparatorUI extends MetalSeparatorUI
  23. {
  24. public static ComponentUI createUI( JComponent c )
  25. {
  26. return new MetalPopupMenuSeparatorUI();
  27. }
  28. public void paint( Graphics g, JComponent c )
  29. {
  30. Dimension s = c.getSize();
  31. g.setColor( c.getForeground() );
  32. g.drawLine( 0, 1, s.width, 1 );
  33. g.setColor( c.getBackground() );
  34. g.drawLine( 0, 2, s.width, 2 );
  35. g.drawLine( 0, 0, 0, 0 );
  36. g.drawLine( 0, 3, 0, 3 );
  37. }
  38. public Dimension getPreferredSize( JComponent c )
  39. {
  40. return new Dimension( 0, 4 );
  41. }
  42. }