KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > basic > BasicToolBarSeparatorUI


1 /*
2  * @(#)BasicToolBarSeparatorUI.java 1.13 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.basic;
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.JToolBar JavaDoc;
17 import javax.swing.plaf.*;
18 import javax.swing.plaf.basic.BasicSeparatorUI JavaDoc;
19
20
21 /**
22  * A Basic L&F implementation of ToolBarSeparatorUI. This implementation
23  * is a "combined" view/controller.
24  * <p>
25  *
26  * @version 1.13 12/19/03
27  * @author Jeff Shapiro
28  */

29
30 public class BasicToolBarSeparatorUI extends BasicSeparatorUI JavaDoc
31 {
32     public static ComponentUI createUI( JComponent c )
33     {
34         return new BasicToolBarSeparatorUI JavaDoc();
35     }
36
37     protected void installDefaults( JSeparator s )
38     {
39         Dimension JavaDoc size = ( (JToolBar.Separator JavaDoc)s ).getSeparatorSize();
40
41     if ( size == null || size instanceof UIResource )
42     {
43         JToolBar.Separator JavaDoc sep = (JToolBar.Separator JavaDoc)s;
44         size = (Dimension JavaDoc)(UIManager.get("ToolBar.separatorSize"));
45         if (size != null) {
46         if (sep.getOrientation() == JSeparator.HORIZONTAL) {
47             size = new Dimension JavaDoc(size.height, size.width);
48         }
49         sep.setSeparatorSize(size);
50         }
51     }
52     }
53
54     public void paint( Graphics JavaDoc g, JComponent c )
55     {
56     }
57
58     public Dimension JavaDoc getPreferredSize( JComponent c )
59     {
60         Dimension JavaDoc size = ( (JToolBar.Separator JavaDoc)c ).getSeparatorSize();
61
62     if ( size != null )
63     {
64         return size.getSize();
65     }
66     else
67     {
68         return null;
69     }
70     }
71 }
72
73
74
75
Popular Tags