jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java
changeset 4225 57ec8171fcd5
parent 2 90ce3da70b43
child 5506 202f599c92aa
equal deleted inserted replaced
4224:3cfc595ac892 4225:57ec8171fcd5
    23  * have any questions.
    23  * have any questions.
    24  */
    24  */
    25 
    25 
    26 package javax.swing.plaf.basic;
    26 package javax.swing.plaf.basic;
    27 
    27 
       
    28 import sun.awt.AppContext;
       
    29 
    28 import javax.swing.*;
    30 import javax.swing.*;
    29 
    31 
    30 import java.awt.*;
    32 import java.awt.*;
    31 import java.awt.event.*;
    33 import java.awt.event.*;
    32 import javax.swing.plaf.*;
    34 import javax.swing.plaf.*;
    47  *
    49  *
    48  * @author Jeff Dinkins
    50  * @author Jeff Dinkins
    49  */
    51  */
    50 public class BasicCheckBoxUI extends BasicRadioButtonUI {
    52 public class BasicCheckBoxUI extends BasicRadioButtonUI {
    51 
    53 
    52     private final static BasicCheckBoxUI checkboxUI = new BasicCheckBoxUI();
    54     private static final Object BASIC_CHECK_BOX_UI_KEY = new Object();
    53 
    55 
    54     private final static String propertyPrefix = "CheckBox" + ".";
    56     private final static String propertyPrefix = "CheckBox" + ".";
    55 
    57 
    56     // ********************************
    58     // ********************************
    57     //            Create PLAF
    59     //            Create PLAF
    58     // ********************************
    60     // ********************************
    59     public static ComponentUI createUI(JComponent b) {
    61     public static ComponentUI createUI(JComponent b) {
       
    62         AppContext appContext = AppContext.getAppContext();
       
    63         BasicCheckBoxUI checkboxUI =
       
    64                 (BasicCheckBoxUI) appContext.get(BASIC_CHECK_BOX_UI_KEY);
       
    65         if (checkboxUI == null) {
       
    66             checkboxUI = new BasicCheckBoxUI();
       
    67             appContext.put(BASIC_CHECK_BOX_UI_KEY, checkboxUI);
       
    68         }
    60         return checkboxUI;
    69         return checkboxUI;
    61     }
    70     }
    62 
    71 
    63     public String getPropertyPrefix() {
    72     public String getPropertyPrefix() {
    64         return propertyPrefix;
    73         return propertyPrefix;