--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java Wed Nov 04 10:13:52 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java Fri Nov 06 19:48:09 2009 +0300
@@ -26,6 +26,8 @@
package javax.swing.plaf.metal;
import sun.swing.SwingUtilities2;
+import sun.awt.AppContext;
+
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
@@ -53,7 +55,7 @@
*/
public class MetalRadioButtonUI extends BasicRadioButtonUI {
- private static final MetalRadioButtonUI metalRadioButtonUI = new MetalRadioButtonUI();
+ private static final Object METAL_RADIO_BUTTON_UI_KEY = new Object();
protected Color focusColor;
protected Color selectColor;
@@ -65,6 +67,13 @@
// Create PlAF
// ********************************
public static ComponentUI createUI(JComponent c) {
+ AppContext appContext = AppContext.getAppContext();
+ MetalRadioButtonUI metalRadioButtonUI =
+ (MetalRadioButtonUI) appContext.get(METAL_RADIO_BUTTON_UI_KEY);
+ if (metalRadioButtonUI == null) {
+ metalRadioButtonUI = new MetalRadioButtonUI();
+ appContext.put(METAL_RADIO_BUTTON_UI_KEY, metalRadioButtonUI);
+ }
return metalRadioButtonUI;
}