KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MetalCheckBoxUI.java 1.18 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 javax.swing.plaf.basic.BasicCheckBoxUI JavaDoc;
12
13 import java.awt.*;
14 import java.awt.event.*;
15 import javax.swing.plaf.*;
16 import java.io.Serializable JavaDoc;
17
18
19 /**
20  * CheckboxUI implementation for MetalCheckboxUI
21  * <p>
22  * <strong>Warning:</strong>
23  * Serialized objects of this class will not be compatible with
24  * future Swing releases. The current serialization support is
25  * appropriate for short term storage or RMI between applications running
26  * the same version of Swing. As of 1.4, support for long term storage
27  * of all JavaBeans<sup><font size="-2">TM</font></sup>
28  * has been added to the <code>java.beans</code> package.
29  * Please see {@link java.beans.XMLEncoder}.
30  *
31  * @version 1.18 12/19/03
32  * @author Michael C. Albers
33  *
34  */

35 public class MetalCheckBoxUI extends MetalRadioButtonUI JavaDoc {
36     
37     // NOTE: MetalCheckBoxUI inherts from MetalRadioButtonUI instead
38
// of BasicCheckBoxUI because we want to pick up all the
39
// painting changes made in MetalRadioButtonUI.
40

41     private final static MetalCheckBoxUI JavaDoc checkboxUI = new MetalCheckBoxUI JavaDoc();
42
43     private final static String JavaDoc propertyPrefix = "CheckBox" + ".";
44
45     private boolean defaults_initialized = false;
46
47     // ********************************
48
// Create PlAF
49
// ********************************
50
public static ComponentUI createUI(JComponent b) {
51         return checkboxUI;
52     }
53
54     public String JavaDoc getPropertyPrefix() {
55     return propertyPrefix;
56     }
57
58     // ********************************
59
// Defaults
60
// ********************************
61
public void installDefaults(AbstractButton b) {
62     super.installDefaults(b);
63     if(!defaults_initialized) {
64         icon = UIManager.getIcon(getPropertyPrefix() + "icon");
65         defaults_initialized = true;
66     }
67     }
68     
69     protected void uninstallDefaults(AbstractButton b) {
70     super.uninstallDefaults(b);
71     defaults_initialized = false;
72     }
73
74 }
75
Popular Tags