Search in sources :

Example 56 with AppContext

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

the class MetalRadioButtonUI method createUI.

// ********************************
//        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;
}
Also used : AppContext(sun.awt.AppContext)

Example 57 with AppContext

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

the class MetalButtonUI method createUI.

// ********************************
//          Create PLAF
// ********************************
public static ComponentUI createUI(JComponent c) {
    AppContext appContext = AppContext.getAppContext();
    MetalButtonUI metalButtonUI = (MetalButtonUI) appContext.get(METAL_BUTTON_UI_KEY);
    if (metalButtonUI == null) {
        metalButtonUI = new MetalButtonUI();
        appContext.put(METAL_BUTTON_UI_KEY, metalButtonUI);
    }
    return metalButtonUI;
}
Also used : AppContext(sun.awt.AppContext)

Example 58 with AppContext

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

the class MetalCheckBoxUI method createUI.

// ********************************
//         Create PlAF
// ********************************
public static ComponentUI createUI(JComponent b) {
    AppContext appContext = AppContext.getAppContext();
    MetalCheckBoxUI checkboxUI = (MetalCheckBoxUI) appContext.get(METAL_CHECK_BOX_UI_KEY);
    if (checkboxUI == null) {
        checkboxUI = new MetalCheckBoxUI();
        appContext.put(METAL_CHECK_BOX_UI_KEY, checkboxUI);
    }
    return checkboxUI;
}
Also used : AppContext(sun.awt.AppContext)

Example 59 with AppContext

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

the class MetalLabelUI method createUI.

public static ComponentUI createUI(JComponent c) {
    if (System.getSecurityManager() != null) {
        AppContext appContext = AppContext.getAppContext();
        MetalLabelUI safeMetalLabelUI = (MetalLabelUI) appContext.get(METAL_LABEL_UI_KEY);
        if (safeMetalLabelUI == null) {
            safeMetalLabelUI = new MetalLabelUI();
            appContext.put(METAL_LABEL_UI_KEY, safeMetalLabelUI);
        }
        return safeMetalLabelUI;
    }
    return metalLabelUI;
}
Also used : AppContext(sun.awt.AppContext)

Example 60 with AppContext

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

the class bug6938813 method validate.

private static void validate() throws Exception {
    AppContext appContext = AppContext.getAppContext();
    assertTrue(DTD.getDTD(DTD_KEY).getName().equals(DTD_KEY), "DTD.getDTD() mixed AppContexts");
    // Spoil hash value
    DTD invalidDtd = DTD.getDTD("invalid DTD");
    DTD.putDTDHash(DTD_KEY, invalidDtd);
    assertTrue(DTD.getDTD(DTD_KEY) == invalidDtd, "Something wrong with DTD.getDTD()");
    Object dtdKey = getParserDelegator_DTD_KEY();
    assertTrue(appContext.get(dtdKey) == null, "ParserDelegator mixed AppContexts");
    // Init default DTD
    new ParserDelegator();
    Object dtdValue = appContext.get(dtdKey);
    assertTrue(dtdValue != null, "ParserDelegator.defaultDTD isn't initialized");
    // Try reinit default DTD
    new ParserDelegator();
    assertTrue(dtdValue == appContext.get(dtdKey), "ParserDelegator.defaultDTD created a duplicate");
    HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
    if (styleSheet == null) {
        // First AppContext
        styleSheet = htmlEditorKit.getStyleSheet();
        assertTrue(styleSheet != null, "htmlEditorKit.getStyleSheet() returns null");
        assertTrue(htmlEditorKit.getStyleSheet() == styleSheet, "Something wrong with htmlEditorKit.getStyleSheet()");
    } else {
        assertTrue(htmlEditorKit.getStyleSheet() != styleSheet, "HtmlEditorKit.getStyleSheet() mixed AppContexts");
    }
}
Also used : ParserDelegator(javax.swing.text.html.parser.ParserDelegator) DTD(javax.swing.text.html.parser.DTD) AppContext(sun.awt.AppContext) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit)

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