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


    }

    // Font size for defaults
    int fontSize = config.getInt(null, ConfigurationValueInteger.FONT_SIZE);
    if (fontSize > 0) {
      UIDefaults defaults = UIManager.getLookAndFeelDefaults();
      for (Object key : defaults.keySet()) {
        Font font = defaults.getFont(key);
        if (font != null) {
          font = font.deriveFont((float) (font.getSize() + fontSize));
          defaults.put(key, font);
        }
      }
    }

    // Debugging
View Full Code Here

        return null;
    }
   
    public static void setLookAndFeel(int fontSize) throws Exception {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        UIDefaults defaults = UIManager.getDefaults();
        Enumeration<Object> keys = defaults.keys();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();

            if ((key instanceof String) && (((String) key).endsWith(".font"))) {
                FontUIResource font = (FontUIResource) UIManager.get(key);
                defaults.put (key, new FontUIResource(font.getFontName(), font.getStyle(), fontSize));
            }
        }
     }
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

     * @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

            // get all the defaults from UIManager.getDefaults() and put them
            // into the compiledDefaults
            compileDefaults(compiledDefaults, UIManager.getDefaults());

            // This second statement pulls defaults from the laf defaults
            UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();
            compileDefaults(compiledDefaults, lafDefaults);
           
            // if it has not already been done, add a listener to both
            // UIManager.getDefaults() and UIManager.getLookAndFeelDefaults().
            PropertyChangeListener pcl = (PropertyChangeListener)
                    ctx.get("NimbusStyle.defaults.pcl");
           
            // if pcl is null, then it has not yet been registered with
            // the UIManager defaults for this app context
            if (pcl == null) {
                // create a PCL which will simply clear out the compiled
                // defaults from the app context, causing it to be recomputed
                // on subsequent passes
                pcl = new DefaultsListener();
                // add the PCL to both defaults tables that we pay attention
                // to, so that if the UIDefaults are updated, then the
                // precompiled defaults will be cleared from the app context
                // and recomputed on subsequent passes
                UIManager.getDefaults().addPropertyChangeListener(pcl);
                UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl);
                // save the PCL to the app context as a marker indicating
                // that the PCL has been registered so we don't end up adding
                // more than one listener to the UIDefaults tables.
                ctx.put("NimbusStyle.defaults.pcl", pcl);
            }
           
            // store the defaults for reuse
            ctx.put("NimbusStyle.defaults", compiledDefaults);
        }
       
        TreeMap<String, Object> defaults = compiledDefaults.get(prefix);
       
        // inspect the client properties for the key "Nimbus.Overrides". If the
        // value is an instance of UIDefaults, then these defaults are used
        // in place of, or in addition to, the defaults in UIManager.
        if (component != null) {
            Object o = component.getClientProperty("Nimbus.Overrides");
            if (o instanceof UIDefaults) {
                Object i = component.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

     * @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

                    UIManager.setLookAndFeel(laf);
                } catch (UnsupportedLookAndFeelException e1) {
                    e1.printStackTrace();
                }
                // get defaults
                UIDefaults defaults = UIManager.getLookAndFeelDefaults();
                // split of components
                Map<String, Map<String, Object>> componentDefaults = new HashMap<String, Map<String, Object>>();
                Map<String, Object> others = new HashMap<String, Object>();
                Object[] defaultKeys = defaults.keySet().toArray();
                for (Object keyObj : defaultKeys) {
                    String key = keyObj.toString();
                    if (key.contains("MouseOver")) {
                        continue;
                    }
                    boolean matchesComponent = false;
                    componentloop: for (String componentName : NIMBUS_COMPONENTS) {
                        if (key.startsWith(componentName + ".") || key.startsWith(componentName + ":")
                                || key.startsWith(componentName + "[")) {
                            Map<String, Object> keys = componentDefaults.get(componentName);
                            if (keys == null) {
                                keys = new HashMap<String, Object>();
                                componentDefaults.put(componentName, keys);
                            }
                            keys.put(key, defaults.get(key));
                            matchesComponent = true;
                            break componentloop;
                        }
                    }
                    if (!matchesComponent) others.put(key, defaults.get(key));
                }
                // split out primary, secondary colors
                Map<String, Object> primaryColors = new HashMap<String, Object>();
                Map<String, Object> secondaryColors = new HashMap<String, Object>();
                for (Map.Entry<String, Object> entry : others.entrySet()) {
View Full Code Here

    return new Office2003ColorManager();
  }


  public UIDefaults getDefaults() {
    UIDefaults defaults = super.getDefaults();
    initSystemColorDefaults2003(defaults);
    initComponentDefaults2003(defaults);
    return defaults;
  }
View Full Code Here

            // get all the defaults from UIManager.getDefaults() and put them
            // into the compiledDefaults
            compileDefaults(compiledDefaults, UIManager.getDefaults());

            // This second statement pulls defaults from the laf defaults
            UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();

            compileDefaults(compiledDefaults, lafDefaults);

            // if it has not already been done, add a listener to both
            // UIManager.getDefaults() and UIManager.getLookAndFeelDefaults().
            PropertyChangeListener pcl = (PropertyChangeListener) ctx.get("SeaGlassStyle.defaults.pcl");

            // if pcl is null, then it has not yet been registered with
            // the UIManager defaults for this app context
            if (pcl == null) {

                // create a PCL which will simply clear out the compiled
                // defaults from the app context, causing it to be recomputed
                // on subsequent passes
                pcl = new DefaultsListener();

                // add the PCL to both defaults tables that we pay attention
                // to, so that if the UIDefaults are updated, then the
                // precompiled defaults will be cleared from the app context
                // and recomputed on subsequent passes
                UIManager.getDefaults().addPropertyChangeListener(pcl);
                UIManager.getLookAndFeelDefaults().addPropertyChangeListener(pcl);

                // save the PCL to the app context as a marker indicating
                // that the PCL has been registered so we don't end up adding
                // more than one listener to the UIDefaults tables.
                ctx.put("SeaGlassStyle.defaults.pcl", pcl);
            }

            // store the defaults for reuse
            ctx.put("SeaGlassStyle.defaults", compiledDefaults);
        }

        TreeMap<String, Object> defaults = compiledDefaults.get(prefix);
        if (defaults == null) {
            defaults = new TreeMap<String, Object>();
        }

        // inspect the client properties for the key "SeaGlass.Overrides". If
        // the
        // value is an instance of UIDefaults, then these defaults are used
        // in place of, or in addition to, the defaults in UIManager.
        if (component != null) {
            Object o = component.getClientProperty("SeaGlass.Overrides");

            if (o instanceof UIDefaults) {
                Object                  i       = component.getClientProperty("SeaGlass.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) {
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.