Search in sources :

Example 46 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class ImageIcon method getTracker.

/**
     * Returns the MediaTracker for the current AppContext, creating a new
     * MediaTracker if necessary.
     */
private MediaTracker getTracker() {
    Object trackerObj;
    AppContext ac = AppContext.getAppContext();
    // If null, synchronize, re-check for null, and put new tracker
    synchronized (ac) {
        trackerObj = ac.get(TRACKER_KEY);
        if (trackerObj == null) {
            Component comp = new Component() {
            };
            trackerObj = new MediaTracker(comp);
            ac.put(TRACKER_KEY, trackerObj);
        }
    }
    return (MediaTracker) trackerObj;
}
Also used : AppContext(sun.awt.AppContext)

Example 47 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class BasicRadioButtonUI method createUI.

// ********************************
//        Create PLAF
// ********************************
/**
     * Returns an instance of {@code BasicRadioButtonUI}.
     *
     * @param b a component
     * @return an instance of {@code BasicRadioButtonUI}
     */
public static ComponentUI createUI(JComponent b) {
    AppContext appContext = AppContext.getAppContext();
    BasicRadioButtonUI radioButtonUI = (BasicRadioButtonUI) appContext.get(BASIC_RADIO_BUTTON_UI_KEY);
    if (radioButtonUI == null) {
        radioButtonUI = new BasicRadioButtonUI();
        appContext.put(BASIC_RADIO_BUTTON_UI_KEY, radioButtonUI);
    }
    return radioButtonUI;
}
Also used : AppContext(sun.awt.AppContext)

Example 48 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class BasicPopupMenuUI method installListeners.

protected void installListeners() {
    if (popupMenuListener == null) {
        popupMenuListener = new BasicPopupMenuListener();
    }
    popupMenu.addPopupMenuListener(popupMenuListener);
    if (menuKeyListener == null) {
        menuKeyListener = new BasicMenuKeyListener();
    }
    popupMenu.addMenuKeyListener(menuKeyListener);
    AppContext context = AppContext.getAppContext();
    synchronized (MOUSE_GRABBER_KEY) {
        MouseGrabber mouseGrabber = (MouseGrabber) context.get(MOUSE_GRABBER_KEY);
        if (mouseGrabber == null) {
            mouseGrabber = new MouseGrabber();
            context.put(MOUSE_GRABBER_KEY, mouseGrabber);
        }
    }
    synchronized (MENU_KEYBOARD_HELPER_KEY) {
        MenuKeyboardHelper helper = (MenuKeyboardHelper) context.get(MENU_KEYBOARD_HELPER_KEY);
        if (helper == null) {
            helper = new MenuKeyboardHelper();
            context.put(MENU_KEYBOARD_HELPER_KEY, helper);
            MenuSelectionManager msm = MenuSelectionManager.defaultManager();
            msm.addChangeListener(helper);
        }
    }
}
Also used : AppContext(sun.awt.AppContext)

Example 49 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class BasicLookAndFeel method uninitialize.

/**
     * {@inheritDoc}
     */
public void uninitialize() {
    AppContext context = AppContext.getAppContext();
    synchronized (BasicPopupMenuUI.MOUSE_GRABBER_KEY) {
        Object grabber = context.get(BasicPopupMenuUI.MOUSE_GRABBER_KEY);
        if (grabber != null) {
            ((BasicPopupMenuUI.MouseGrabber) grabber).uninstall();
        }
    }
    synchronized (BasicPopupMenuUI.MENU_KEYBOARD_HELPER_KEY) {
        Object helper = context.get(BasicPopupMenuUI.MENU_KEYBOARD_HELPER_KEY);
        if (helper != null) {
            ((BasicPopupMenuUI.MenuKeyboardHelper) helper).uninstall();
        }
    }
    if (invocator != null) {
        AccessController.doPrivileged(invocator);
        invocator = null;
    }
    if (disposer != null) {
        // Note that we're likely calling removePropertyChangeListener()
        // during the course of AppContext.firePropertyChange().
        // However, EventListenerAggreggate has code to safely modify
        // the list under such circumstances.
        context.removePropertyChangeListener(AppContext.GUI_DISPOSED, disposer);
        disposer = null;
    }
}
Also used : AppContext(sun.awt.AppContext)

Example 50 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class DataTransferer method processDataConversionRequests.

public void processDataConversionRequests() {
    if (EventQueue.isDispatchThread()) {
        AppContext appContext = AppContext.getAppContext();
        getToolkitThreadBlockedHandler().lock();
        try {
            Runnable dataConverter = (Runnable) appContext.get(DATA_CONVERTER_KEY);
            if (dataConverter != null) {
                dataConverter.run();
                appContext.remove(DATA_CONVERTER_KEY);
            }
        } finally {
            getToolkitThreadBlockedHandler().unlock();
        }
    }
}
Also used : AppContext(sun.awt.AppContext)

Aggregations

AppContext (sun.awt.AppContext)74 HashMap (java.util.HashMap)3 Hashtable (java.util.Hashtable)3 Locale (java.util.Locale)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 EventListenerAggregate (sun.awt.EventListenerAggregate)3 FlavorListener (java.awt.datatransfer.FlavorListener)2 WeakReference (java.lang.ref.WeakReference)2 Map (java.util.Map)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 LookAndFeel (javax.swing.LookAndFeel)2 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)2 MetalTheme (javax.swing.plaf.metal.MetalTheme)2 ValueNamePair (org.compiere.util.ValueNamePair)2 PeerEvent (sun.awt.PeerEvent)2 AccumulativeRunnable (sun.swing.AccumulativeRunnable)2 Container (java.awt.Container)1 EventQueue (java.awt.EventQueue)1 Font (java.awt.Font)1 Rectangle (java.awt.Rectangle)1