This commit is contained in:
prrace 2026-01-26 21:34:32 -08:00
parent c69275ddfe
commit fe0d424cf2
6 changed files with 15 additions and 66 deletions

View File

@ -39,8 +39,6 @@ import com.sun.java.swing.plaf.windows.TMSchema.Part;
import com.sun.java.swing.plaf.windows.TMSchema.Prop;
import com.sun.java.swing.plaf.windows.XPStyle.Skin;
import sun.awt.AppContext;
/**
* A class to help mimic Vista theme animations. The only kind of
* animation it handles for now is 'transition' animation (this seems
@ -68,8 +66,7 @@ final class AnimationController implements ActionListener, PropertyChangeListene
Boolean.getBoolean("swing.disablevistaanimation");
private static final Object ANIMATION_CONTROLLER_KEY =
new StringBuilder("ANIMATION_CONTROLLER_KEY");
private static AnimationController animationController;
private final Map<JComponent, Map<Part, AnimationState>> animationStateMap =
new WeakHashMap<JComponent, Map<Part, AnimationState>>();
@ -80,13 +77,10 @@ final class AnimationController implements ActionListener, PropertyChangeListene
new javax.swing.Timer(1000/30, this);
private static synchronized AnimationController getAnimationController() {
AppContext appContext = AppContext.getAppContext();
Object obj = appContext.get(ANIMATION_CONTROLLER_KEY);
if (obj == null) {
obj = new AnimationController();
appContext.put(ANIMATION_CONTROLLER_KEY, obj);
if (animationController == null) {
animationController = new AnimationController();
}
return (AnimationController) obj;
return animationController;
}
private AnimationController() {
@ -316,8 +310,7 @@ final class AnimationController implements ActionListener, PropertyChangeListene
timer.stop();
UIManager.removePropertyChangeListener(this);
synchronized (AnimationController.class) {
AppContext.getAppContext()
.put(ANIMATION_CONTROLLER_KEY, null);
animationController = null;
}
}

View File

@ -47,8 +47,6 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicButtonUI;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import sun.awt.AppContext;
import static com.sun.java.swing.plaf.windows.TMSchema.Part;
import static com.sun.java.swing.plaf.windows.TMSchema.State;
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
@ -69,20 +67,13 @@ public final class WindowsButtonUI extends BasicButtonUI
private boolean defaults_initialized = false;
private static final Object WINDOWS_BUTTON_UI_KEY = new Object();
private static final ComponentUI UI = new WindowsButtonUI();
// ********************************
// Create PLAF
// ********************************
public static ComponentUI createUI(JComponent c) {
AppContext appContext = AppContext.getAppContext();
WindowsButtonUI windowsButtonUI =
(WindowsButtonUI) appContext.get(WINDOWS_BUTTON_UI_KEY);
if (windowsButtonUI == null) {
windowsButtonUI = new WindowsButtonUI();
appContext.put(WINDOWS_BUTTON_UI_KEY, windowsButtonUI);
}
return windowsButtonUI;
return UI;
}

View File

@ -30,8 +30,6 @@ import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import sun.awt.AppContext;
/**
* Windows check box.
*
@ -43,7 +41,7 @@ public final class WindowsCheckBoxUI extends WindowsRadioButtonUI
// of BasicCheckBoxUI because we want to pick up all the
// painting changes made in WindowsRadioButtonUI.
private static final Object WINDOWS_CHECK_BOX_UI_KEY = new Object();
private static final ComponentUI UI = new WindowsCheckBoxUI();
private static final String propertyPrefix = "CheckBox" + ".";
@ -53,14 +51,7 @@ public final class WindowsCheckBoxUI extends WindowsRadioButtonUI
// Create PLAF
// ********************************
public static ComponentUI createUI(JComponent c) {
AppContext appContext = AppContext.getAppContext();
WindowsCheckBoxUI windowsCheckBoxUI =
(WindowsCheckBoxUI) appContext.get(WINDOWS_CHECK_BOX_UI_KEY);
if (windowsCheckBoxUI == null) {
windowsCheckBoxUI = new WindowsCheckBoxUI();
appContext.put(WINDOWS_CHECK_BOX_UI_KEY, windowsCheckBoxUI);
}
return windowsCheckBoxUI;
return UI;
}

View File

@ -34,7 +34,6 @@ import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicLabelUI;
import sun.awt.AppContext;
import sun.swing.MnemonicHandler;
import sun.swing.SwingUtilities2;
@ -43,20 +42,13 @@ import sun.swing.SwingUtilities2;
*/
public final class WindowsLabelUI extends BasicLabelUI {
private static final Object WINDOWS_LABEL_UI_KEY = new Object();
private static final ComponentUI UI = new WindowsLabelUI();
// ********************************
// Create PLAF
// ********************************
public static ComponentUI createUI(JComponent c) {
AppContext appContext = AppContext.getAppContext();
WindowsLabelUI windowsLabelUI =
(WindowsLabelUI) appContext.get(WINDOWS_LABEL_UI_KEY);
if (windowsLabelUI == null) {
windowsLabelUI = new WindowsLabelUI();
appContext.put(WINDOWS_LABEL_UI_KEY, windowsLabelUI);
}
return windowsLabelUI;
return UI;
}
@Override

View File

@ -38,14 +38,12 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicRadioButtonUI;
import sun.awt.AppContext;
/**
* Windows rendition of the component.
*/
public class WindowsRadioButtonUI extends BasicRadioButtonUI
{
private static final Object WINDOWS_RADIO_BUTTON_UI_KEY = new Object();
private static final ComponentUI UI = new WindowsRadioButtonUI();
protected int dashedRectGapX;
protected int dashedRectGapY;
@ -60,14 +58,7 @@ public class WindowsRadioButtonUI extends BasicRadioButtonUI
// Create PLAF
// ********************************
public static ComponentUI createUI(JComponent c) {
AppContext appContext = AppContext.getAppContext();
WindowsRadioButtonUI windowsRadioButtonUI =
(WindowsRadioButtonUI) appContext.get(WINDOWS_RADIO_BUTTON_UI_KEY);
if (windowsRadioButtonUI == null) {
windowsRadioButtonUI = new WindowsRadioButtonUI();
appContext.put(WINDOWS_RADIO_BUTTON_UI_KEY, windowsRadioButtonUI);
}
return windowsRadioButtonUI;
return UI;
}
// ********************************

View File

@ -38,8 +38,6 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicGraphicsUtils;
import javax.swing.plaf.basic.BasicToggleButtonUI;
import sun.awt.AppContext;
/**
* A Windows toggle button.
*
@ -54,19 +52,12 @@ public final class WindowsToggleButtonUI extends BasicToggleButtonUI
protected Color focusColor;
private static final Object WINDOWS_TOGGLE_BUTTON_UI_KEY = new Object();
private static final ComponentUI UI = new WindowsToggleButtonUI();
private boolean defaults_initialized = false;
public static ComponentUI createUI(JComponent b) {
AppContext appContext = AppContext.getAppContext();
WindowsToggleButtonUI windowsToggleButtonUI =
(WindowsToggleButtonUI) appContext.get(WINDOWS_TOGGLE_BUTTON_UI_KEY);
if (windowsToggleButtonUI == null) {
windowsToggleButtonUI = new WindowsToggleButtonUI();
appContext.put(WINDOWS_TOGGLE_BUTTON_UI_KEY, windowsToggleButtonUI);
}
return windowsToggleButtonUI;
return UI;
}