Package javax.swing

Examples of javax.swing.UIDefaults


        return Boolean.TRUE.equals(docProperty);
    }

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

        return uiDefaults;
    }
View Full Code Here


     * 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

        jtc.getKeymap().removeKeyStrokeBinding(keyStrokeY);
        jtc.getKeymap().removeKeyStrokeBinding(keyStrokeZ);
    }

    private Color getColorProperty(final String key) {
        final UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults();
        return uiDefaults.getColor("TextArea." + key);
    }
View Full Code Here

    public void testAudioActionMap() {
        assertEquals(13, lf.getAudioActionMap().size());
    }

    public void testDefaultsTable() {
        UIDefaults defaults = lf.getDefaults();
        if (isHarmony()) {
            assertEquals(475, defaults.size());
        }
        assertNull(lookAndFeelInstance().getDefaults());
    }
View Full Code Here

    public void testGetAcceleratorForeground() {
        assertEquals(metalTheme.getPrimary1(), metalTheme.getAcceleratorForeground());
    }

    public void testAddCustomEntriesToTable() {
        UIDefaults defs = new UIDefaults();
        metalTheme.addCustomEntriesToTable(defs);
        assertEquals(0, defs.size());
        metalTheme.addCustomEntriesToTable(null);
    }
View Full Code Here

  private static class ResultsCellRenderer implements ListCellRenderer {
    private final Color selectedBackground;
    private final Color selectedForeground;

    ResultsCellRenderer() {
      UIDefaults defaults = UIManager.getDefaults();
      selectedBackground = defaults.getColor("List.selectionBackground");
      selectedForeground = defaults.getColor("List.selectionForeground");
    }
View Full Code Here

    public static void install() {
        // don't install directory chooser if standard chooser is desired
        if (isStandardChooserForced()) {
            return;
        }
        final UIDefaults uid = UIManager.getDefaults();
        originalImpl = (Class<? extends FileChooserUI>) uid.getUIClass(KEY);
        Class impl = DelegatingChooserUI.class;
        final String val = impl.getName();
        // don't install dirchooser if quickfilechooser is present
        if (!isQuickFileChooser(uid.get(KEY))) {
            uid.put(KEY, val);
            // To make it work in NetBeans too:
            uid.put(val, impl);
        }
        // #61147: prevent NB from switching to a different UI later (under GTK):
        uid.addPropertyChangeListener(pcl = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                String name = evt.getPropertyName();
                Object className = uid.get(KEY);
                if ((name.equals(KEY) || name.equals("UIDefaults")) && !val.equals(className)
                        && !isQuickFileChooser(className)) {
                    uid.put(KEY, val);
                }
            }
        });
    }
View Full Code Here

    }
   
    public static void uninstall() {
        if (isInstalled()) {
            assert pcl != null;
            UIDefaults uid = UIManager.getDefaults();
            uid.removePropertyChangeListener(pcl);
            pcl = null;
            String val = originalImpl.getName();
            uid.put(KEY, val);
            uid.put(val, originalImpl);
            originalImpl = null;
        }
    }
View Full Code Here

   * Sets the Font attribute of the SkinUtils class
   *
   * @param f  The new Font value
   */
  public static void setFont(Font f) {
    UIDefaults defs = UIManager.getDefaults();
    for (Enumeration keys = defs.keys(); keys.hasMoreElements();) {
      Object o = keys.nextElement();
      if (o instanceof String) {
        String aKey = (String) o;
        if (aKey.endsWith(".font")
            || aKey.endsWith(".titleFont")
            || aKey.endsWith(".acceleratorFont")) {
          if (defs.get(aKey) instanceof FontUIResource) {
            UIManager.put(aKey, f);
          }
        }
      }
    }
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.