--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java Wed Nov 04 10:13:52 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java Fri Nov 06 19:48:09 2009 +0300
@@ -25,6 +25,8 @@
package javax.swing.plaf.basic;
+import sun.awt.AppContext;
+
import javax.swing.*;
import java.awt.*;
@@ -49,7 +51,7 @@
*/
public class BasicCheckBoxUI extends BasicRadioButtonUI {
- private final static BasicCheckBoxUI checkboxUI = new BasicCheckBoxUI();
+ private static final Object BASIC_CHECK_BOX_UI_KEY = new Object();
private final static String propertyPrefix = "CheckBox" + ".";
@@ -57,6 +59,13 @@
// Create PLAF
// ********************************
public static ComponentUI createUI(JComponent b) {
+ AppContext appContext = AppContext.getAppContext();
+ BasicCheckBoxUI checkboxUI =
+ (BasicCheckBoxUI) appContext.get(BASIC_CHECK_BOX_UI_KEY);
+ if (checkboxUI == null) {
+ checkboxUI = new BasicCheckBoxUI();
+ appContext.put(BASIC_CHECK_BOX_UI_KEY, checkboxUI);
+ }
return checkboxUI;
}