use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.
the class WindowsToggleButtonUI method createUI.
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;
}
use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.
the class SystemFlavorMap method getDefaultFlavorMap.
/**
* Returns the default FlavorMap for this thread's ClassLoader.
*/
public static FlavorMap getDefaultFlavorMap() {
AppContext context = AppContext.getAppContext();
FlavorMap fm = (FlavorMap) context.get(FLAVOR_MAP_KEY);
if (fm == null) {
fm = new SystemFlavorMap();
context.put(FLAVOR_MAP_KEY, fm);
}
return fm;
}
use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.
the class InputMethodEvent method getMostRecentEventTimeForSource.
/**
* Get the most recent event time in the {@code EventQueue} which the {@code source}
* belongs to.
*
* @param source the source of the event
* @exception IllegalArgumentException if source is null.
* @return most recent event time in the {@code EventQueue}
*/
private static long getMostRecentEventTimeForSource(Object source) {
if (source == null) {
// throw the IllegalArgumentException to conform to EventObject spec
throw new IllegalArgumentException("null source");
}
AppContext appContext = SunToolkit.targetToAppContext(source);
EventQueue eventQueue = SunToolkit.getSystemEventQueueImplPP(appContext);
return AWTAccessor.getEventQueueAccessor().getMostRecentEventTime(eventQueue);
}
use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.
the class SwingWorker method getDoSubmit.
private static AccumulativeRunnable<Runnable> getDoSubmit() {
synchronized (DO_SUBMIT_KEY) {
final AppContext appContext = AppContext.getAppContext();
Object doSubmit = appContext.get(DO_SUBMIT_KEY);
if (doSubmit == null) {
doSubmit = new DoSubmitAccumulativeRunnable();
appContext.put(DO_SUBMIT_KEY, doSubmit);
}
return (AccumulativeRunnable<Runnable>) doSubmit;
}
}
use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.
the class MenuSelectionManager method defaultManager.
/**
* Returns the default menu selection manager.
*
* @return a MenuSelectionManager object
*/
public static MenuSelectionManager defaultManager() {
synchronized (MENU_SELECTION_MANAGER_KEY) {
AppContext context = AppContext.getAppContext();
MenuSelectionManager msm = (MenuSelectionManager) context.get(MENU_SELECTION_MANAGER_KEY);
if (msm == null) {
msm = new MenuSelectionManager();
context.put(MENU_SELECTION_MANAGER_KEY, msm);
// installing additional listener if found in the AppContext
Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY);
if (o != null && o instanceof ChangeListener) {
msm.addChangeListener((ChangeListener) o);
}
}
return msm;
}
}
Aggregations