Package javax.swing

Examples of javax.swing.UIDefaults


     * Returns the table with defaults values
     * @return UIDefaults result
     */
    public UIDefaults getDefaults() {
        createDefaultTheme();
        UIDefaults result = super.getDefaults();
        metalTheme.addCustomEntriesToTable(result);
        result.addResourceBundle(METAL_RESOURCE_BUNDLE);

        return result;
    }
View Full Code Here


        Object name = a.getValue(Action.NAME);
        map.put(name, a);
    }

    final void installUIActionMap() {
        UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();
        String propertyName = getPropertyPrefix() + ".actionMap";
        ActionMap actionMap1 = new ActionMapUIResource();
        putActionToActionMap(focusAction, actionMap1);
        Object actionMap2 = uiDefaults.get(propertyName);
        if (actionMap2 == null) {
            ActionMapUIResource map = new ActionMapUIResource();
            Action[] actions = component.getActions();
            for (int i = 0; i < actions.length; i++) {
                putActionToActionMap(actions[i], map);
            }
            putActionToActionMap(TransferHandler.getPasteAction(), map);
            putActionToActionMap(TransferHandler.getCutAction(), map);
            putActionToActionMap(TransferHandler.getCopyAction(), map);

            actionMap2 = map;
            if (!(component instanceof JEditorPane)) {
                uiDefaults.put(propertyName, map);
            }
        }
        actionMap1.setParent((ActionMap)actionMap2);
        SwingUtilities.replaceUIActionMap(component, actionMap1);
    }
View Full Code Here

        uiDefs.putDefaults(basicComponentUIs);
    }

    public UIDefaults getDefaults() {
        if (uiDefaults == null) {
            uiDefaults = new UIDefaults();
            initClassDefaults(uiDefaults);
            initSystemColorDefaults(uiDefaults);
            initComponentDefaults(uiDefaults);
            uiDefaults.addResourceBundle(RESOURCE_BUNDLE);
        }
View Full Code Here

        return Boolean.TRUE.equals(docProperty);
    }

    private UIDefaults getUIDefaults() {
        if (uiDefaults == null) {
            uiDefaults = new UIDefaults();
        }

        return uiDefaults;
    }
View Full Code Here

            jta = (JTextArea) c;

            JTextArea editor = jta;

            UIDefaults uidefaults = XToolkit.getUIDefaults();

            String prefix = getPropertyPrefix();
            Font f = editor.getFont();
            if ((f == null) || (f instanceof UIResource)) {
                editor.setFont(uidefaults.getFont(prefix + ".font"));
            }

            Color bg = editor.getBackground();
            if ((bg == null) || (bg instanceof UIResource)) {
                editor.setBackground(uidefaults.getColor(prefix + ".background"));
            }

            Color fg = editor.getForeground();
            if ((fg == null) || (fg instanceof UIResource)) {
                editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
            }

            Color color = editor.getCaretColor();
            if ((color == null) || (color instanceof UIResource)) {
                editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
            }

            Color s = editor.getSelectionColor();
            if ((s == null) || (s instanceof UIResource)) {
                editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
            }

            Color sfg = editor.getSelectedTextColor();
            if ((sfg == null) || (sfg instanceof UIResource)) {
                editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
            }

            Color dfg = editor.getDisabledTextColor();
            if ((dfg == null) || (dfg instanceof UIResource)) {
                editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
            }

            Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight);
            editor.setBorder(new BorderUIResource.CompoundBorderUIResource(
                b,new EmptyBorder(2, 2, 2, 2)));

            Insets margin = editor.getMargin();
            if (margin == null || margin instanceof UIResource) {
                editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
            }
        }
View Full Code Here

        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);
            }
View Full Code Here

            button.setUI(new BasicButtonUI());
        }
       
        button.setRolloverEnabled(true);
       
        UIDefaults table = UIManager.getLookAndFeelDefaults();
        button.setBorder(new BasicBorders.RolloverButtonBorder(
                table.getColor("controlShadow"), //$NON-NLS-1$
                table.getColor("controlDkShadow"), //$NON-NLS-1$
                table.getColor("controlHighlight"), //$NON-NLS-1$
                table.getColor("controlLtHighlight"))); //$NON-NLS-1$
    }
View Full Code Here

            Object o = component.get().getClientProperty("Nimbus.Overrides");
            if (o instanceof UIDefaults) {
                Object i = component.get().getClientProperty(
                        "Nimbus.Overrides.InheritDefaults");
                boolean inherit = i instanceof Boolean ? (Boolean)i : true;
                UIDefaults d = (UIDefaults)o;
                TreeMap<String, Object> map = new TreeMap<String, Object>();
                for (Object obj : d.keySet()) {
                    if (obj instanceof String) {
                        String key = (String)obj;
                        if (key.startsWith(prefix)) {
                            map.put(key, d.get(key));
                        }
                    }
                }
                if (inherit) {
                    defaults.putAll(map);
View Full Code Here

            jtf = (JTextField) c;

            JTextField editor = jtf;

            UIDefaults uidefaults = XToolkit.getUIDefaults();

            String prefix = getPropertyPrefix();
            Font f = editor.getFont();
            if ((f == null) || (f instanceof UIResource)) {
                editor.setFont(uidefaults.getFont(prefix + ".font"));
            }

            Color bg = editor.getBackground();
            if ((bg == null) || (bg instanceof UIResource)) {
                editor.setBackground(uidefaults.getColor(prefix + ".background"));
            }

            Color fg = editor.getForeground();
            if ((fg == null) || (fg instanceof UIResource)) {
                editor.setForeground(uidefaults.getColor(prefix + ".foreground"));
            }

            Color color = editor.getCaretColor();
            if ((color == null) || (color instanceof UIResource)) {
                editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground"));
            }

            Color s = editor.getSelectionColor();
            if ((s == null) || (s instanceof UIResource)) {
                editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground"));
            }

            Color sfg = editor.getSelectedTextColor();
            if ((sfg == null) || (sfg instanceof UIResource)) {
                editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground"));
            }

            Color dfg = editor.getDisabledTextColor();
            if ((dfg == null) || (dfg instanceof UIResource)) {
                editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground"));
            }

            Border b = editor.getBorder();
            if ((b == null) || (b instanceof UIResource)) {
                editor.setBorder(uidefaults.getBorder(prefix + ".border"));
            }

            Insets margin = editor.getMargin();
            if (margin == null || margin instanceof UIResource) {
                editor.setMargin(uidefaults.getInsets(prefix + ".margin"));
            }
        }
View Full Code Here

        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);
            }
View Full Code Here

TOP

Related Classes of javax.swing.UIDefaults

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.