Package javax.swing

Examples of javax.swing.UIDefaults


        private final int iconHeight;
        private final int iconWidth;

        public TristateCheckBoxIcon() {
            // Assume that the UI has not changed since the checkbos was created
            UIDefaults defaults = UIManager.getLookAndFeelDefaults();
            final Icon icon = (Icon) defaults.get("CheckBox.icon");
            iconHeight = icon.getIconHeight();
            iconWidth = icon.getIconWidth();
        }
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

   * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6723524
   */
  private static void fixNimbusTables() {
    LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
    if (lookAndFeel.getClass().toString().contains("NimbusLookAndFeel")) {
      UIDefaults defaults = lookAndFeel.getDefaults();
      defaults.remove("Table.alternateRowColor");
      defaults.put("Table.showGrid", Boolean.TRUE);
      defaults.put("Table.gridColor", new ColorUIResource(203, 209, 216));
      defaults.put("Table.intercellSpacing", new DimensionUIResource(1, 1));
      defaults.put("Table.background", new ColorUIResource(242, 242, 242));
      defaults.put("Table:\"Table.cellRenderer\".background", new ColorUIResource(242, 242, 242));
    }
  }
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

     * @see #initClassDefaults
     * @see #initSystemColorDefaults
     * @see #initComponentDefaults
     */
    public UIDefaults getDefaults() {
        UIDefaults table = new UIDefaults(610, 0.75f);

        initClassDefaults(table);
        initSystemColorDefaults(table);
        initComponentDefaults(table);

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

    try {
      UIManager.setLookAndFeel(laf);
    } catch (UnsupportedLookAndFeelException e) {
      e.printStackTrace(Output.err);
    }
    UIDefaults nimbUID = laf.getDefaults();
    nimbUID.put("Tree.drawHorizontalLines", true);
    nimbUID.put("Tree.drawVerticalLines", true);
  }
View Full Code Here

        public Font getDefaultFont() {
                return new FontUIResource("SansSerif", Font.BOLD, 14);
        }
        public Collection<Object> getUIPropertyKeys() {
                LookAndFeel looknfeel = UIManager.getLookAndFeel();
                UIDefaults defaults = looknfeel.getDefaults();
                return defaults.keySet();
        }
View Full Code Here

    if (osType != null) Util.log("Is 64-bit: '%s'", osType.contains("64"));

    try {
      UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

      UIDefaults defaults = UIManager.getLookAndFeelDefaults();
      defaults.put("nimbusOrange", defaults.get("nimbusBase"));
      UIManager.put("ProgressBar.selectionForeground", Color.white);
      UIManager.put("ProgressBar.selectionBackground", Color.black);
    } catch (Exception e) {
      Util.log("Warning: Can't get system LnF: " + e);
    }
View Full Code Here

    /**
     * Installs UIDefaults for Help components and installs "lookAndFeel"
     * property change listener.
     */
    static void installUIDefaults() {
        UIDefaults table = UIManager.getLookAndFeelDefaults();
        if (uiDefaults != table) {
            uiDefaults = table;
            UIManager.removePropertyChangeListener(myLAFListener);
            installLookAndFeelDefaults();
            UIManager.addPropertyChangeListener(myLAFListener);
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.