KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > metal > MetalPopupMenuSeparatorUI


1 /*
2  * @(#)MetalPopupMenuSeparatorUI.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.plaf.metal;
9
10 import javax.swing.*;
11 import java.awt.Color JavaDoc;
12 import java.awt.Dimension JavaDoc;
13 import java.awt.Graphics JavaDoc;
14 import java.awt.Insets JavaDoc;
15 import java.awt.Rectangle JavaDoc;
16 import javax.swing.plaf.*;
17
18
19 /**
20  * A Metal L&F implementation of PopupMenuSeparatorUI. This implementation
21  * is a "combined" view/controller.
22  *
23  * @version 1.8 12/19/03
24  * @author Jeff Shapiro
25  */

26
27 public class MetalPopupMenuSeparatorUI extends MetalSeparatorUI JavaDoc
28 {
29     public static ComponentUI createUI( JComponent c )
30     {
31         return new MetalPopupMenuSeparatorUI JavaDoc();
32     }
33
34     public void paint( Graphics JavaDoc g, JComponent c )
35     {
36         Dimension JavaDoc s = c.getSize();
37
38         g.setColor( c.getForeground() );
39         g.drawLine( 0, 1, s.width, 1 );
40
41         g.setColor( c.getBackground() );
42         g.drawLine( 0, 2, s.width, 2 );
43         g.drawLine( 0, 0, 0, 0 );
44         g.drawLine( 0, 3, 0, 3 );
45     }
46
47     public Dimension JavaDoc getPreferredSize( JComponent c )
48     {
49         return new Dimension JavaDoc( 0, 4 );
50     }
51 }
52
53
54
55
56
Popular Tags