Java Code Examples for javax.swing.UIDefaults#get()

The following examples show how to use javax.swing.UIDefaults#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XTextAreaPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 2
Source File: XTextAreaPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 3
Source File: XTextAreaPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 4
Source File: XTextFieldPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 5
Source File: XTextFieldPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 6
Source File: XTextFieldPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 7
Source File: XTextFieldPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 8
Source File: XTextAreaPeer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 9
Source File: XTextFieldPeer.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 10
Source File: XTextFieldPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 11
Source File: XTextAreaPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 12
Source File: XTextFieldPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 13
Source File: XTextAreaPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 14
Source File: XTextFieldPeer.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
Example 15
Source File: NimbusDefaults.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
@Override
public Object createValue(UIDefaults table) {
    try {
        Class c;
        Object cl;
        // See if we should use a separate ClassLoader
        if (table == null || !((cl = table.get("ClassLoader"))
                               instanceof ClassLoader)) {
            cl = Thread.currentThread().
                        getContextClassLoader();
            if (cl == null) {
                // Fallback to the system class loader.
                cl = ClassLoader.getSystemClassLoader();
            }
        }

        c = Class.forName(className, true, (ClassLoader)cl);
        Constructor constructor = c.getConstructor(
                AbstractRegionPainter.PaintContext.class, int.class);
        if (constructor == null) {
            throw new NullPointerException(
                    "Failed to find the constructor for the class: " +
                    className);
        }
        return constructor.newInstance(ctx, which);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 16
Source File: NimbusDefaults.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
@Override
public Object createValue(UIDefaults table) {
    try {
        Class c;
        Object cl;
        // See if we should use a separate ClassLoader
        if (table == null || !((cl = table.get("ClassLoader"))
                               instanceof ClassLoader)) {
            cl = Thread.currentThread().
                        getContextClassLoader();
            if (cl == null) {
                // Fallback to the system class loader.
                cl = ClassLoader.getSystemClassLoader();
            }
        }

        c = Class.forName(className, true, (ClassLoader)cl);
        Constructor constructor = c.getConstructor(
                AbstractRegionPainter.PaintContext.class, int.class);
        if (constructor == null) {
            throw new NullPointerException(
                    "Failed to find the constructor for the class: " +
                    className);
        }
        return constructor.newInstance(ctx, which);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 17
Source File: MenuBarSeparatorInAWTTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public UIDefaults getDefaults() {
    final UIDefaults del = super.getDefaults();
    return new UIDefaults() {
        @Override
        public Object get(Object key) {
            if( "SeparatorUI".equals( key ) )
                assertAWT();
            return del.get(key);
        }
    };
}
 
Example 18
Source File: NimbusDefaults.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
@Override
public Object createValue(UIDefaults table) {
    try {
        Class c;
        Object cl;
        // See if we should use a separate ClassLoader
        if (table == null || !((cl = table.get("ClassLoader"))
                               instanceof ClassLoader)) {
            cl = Thread.currentThread().
                        getContextClassLoader();
            if (cl == null) {
                // Fallback to the system class loader.
                cl = ClassLoader.getSystemClassLoader();
            }
        }

        c = Class.forName(className, true, (ClassLoader)cl);
        Constructor constructor = c.getConstructor(
                AbstractRegionPainter.PaintContext.class, int.class);
        if (constructor == null) {
            throw new NullPointerException(
                    "Failed to find the constructor for the class: " +
                    className);
        }
        return constructor.newInstance(ctx, which);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 19
Source File: SeaGlassLookAndFeel.java    From seaglass with Apache License 2.0 4 votes vote down vote up
/**
         * @see javax.swing.UIDefaults$LazyValue#createValue(javax.swing.UIDefaults)
         */
        @SuppressWarnings("unchecked")
        public Object createValue(UIDefaults table) {
            Constructor constructor = null;
            Object cl = null;
            try {
                Class  c;

                // See if we should use a separate ClassLoader
                // GM: use ClassLoader from this class, if no separate ClassLoader
                cl = table.get("ClassLoader");
                if (cl == null) {
                    cl = getClass().getClassLoader();
                }
                
// GM: doesn't work with WebStart and OSGi                
//                if (table == null || !(cl instanceof ClassLoader)) {
//                    cl = Thread.currentThread().getContextClassLoader();
//
//                    if (cl == null) {
//
//                        // Fallback to the system class loader.
//                        cl = ClassLoader.getSystemClassLoader();
//                    }
//                }

                c = Class.forName(className, true, (ClassLoader) cl);

                // Find inner class for state.
                Class stateClass = Class.forName(className + "$Which", false, (ClassLoader) cl);

                if (stateClass == null) {
                    throw new NullPointerException("Failed to find the constructor for the class: " + className + ".Which");
                }

                constructor = c.getConstructor(stateClass);

                if (constructor == null) {
                    throw new NullPointerException("Failed to find the constructor for the class: " + className);
                }

                return constructor.newInstance(which);
            } catch (Exception e) {
                System.err.println( "createValue: " + which.getClass() + ", " + (constructor != null ? constructor : "") );
                System.err.println( "class loaders: " + which.getClass().getClassLoader() + ", " + cl + ", UIDefaults = " + table );
                e.printStackTrace();

                return null;
            }
        }
 
Example 20
Source File: InternalResourceBundle.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static Object getValue(UIDefaults defaults) {
    return defaults.get("MetalTitlePane.restore.titleAndMnemonic");
}