KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)BasicPanelUI.java 1.11 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 java.awt.*;
11 import javax.swing.*;
12 import javax.swing.border.*;
13 import javax.swing.plaf.*;
14 import java.awt.*;
15 import java.awt.event.*;
16
17
18 /**
19  * BasicPanel implementation
20  *
21  * @version 1.11 12/19/03
22  * @author Steve Wilson
23  */

24 public class BasicPanelUI extends PanelUI {
25
26     // Shared UI object
27
private static PanelUI panelUI;
28
29     public static ComponentUI createUI(JComponent c) {
30     if(panelUI == null) {
31             panelUI = new BasicPanelUI JavaDoc();
32     }
33         return panelUI;
34     }
35
36     public void installUI(JComponent c) {
37         JPanel p = (JPanel)c;
38         super.installUI(p);
39         installDefaults(p);
40     }
41
42     public void uninstallUI(JComponent c) {
43         JPanel p = (JPanel)c;
44         uninstallDefaults(p);
45         super.uninstallUI(c);
46     }
47
48     protected void installDefaults(JPanel p) {
49         LookAndFeel.installColorsAndFont(p,
50                      "Panel.background",
51                      "Panel.foreground",
52                      "Panel.font");
53         LookAndFeel.installBorder(p,"Panel.border");
54         LookAndFeel.installProperty(p, "opaque", Boolean.TRUE);
55     }
56
57     protected void uninstallDefaults(JPanel p) {
58         LookAndFeel.uninstallBorder(p);
59     }
60 }
61
Popular Tags