Java Code Examples for sun.swing.plaf.WindowsKeybindings

The following examples show how to use sun.swing.plaf.WindowsKeybindings. These examples are extracted from open source projects. 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 Project: jdk1.8-source-analysis   Source File: NimbusLookAndFeel.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 2
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 3
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 4
Source Project: jdk8u60   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 5
Source Project: JDKSourceCode1.8   Source File: NimbusLookAndFeel.java    License: MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 6
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 7
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 8
Source Project: Bytecoder   Source File: NimbusLookAndFeel.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 9
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 10
Source Project: jdk8u-jdk   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 11
Source Project: Java8CN   Source File: NimbusLookAndFeel.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 12
Source Project: hottub   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 13
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 14
Source Project: openjdk-8   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 15
Source Project: jdk8u_jdk   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 16
Source Project: jdk8u-jdk   Source File: NimbusLookAndFeel.java    License: GNU General Public License v2.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}
 
Example 17
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Returns the defaults for SeaGlassLookAndFeel.
 *
 * @return the UI defaults for SeaGlassLookAndFeel.
 */
@Override
public UIDefaults getDefaults() {
    if (uiDefaults == null) {
        uiDefaults =  new UIWrapper(super.getDefaults());

        // Install Keybindings for the operating system.
        if (PlatformUtils.isWindows()) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else if (PlatformUtils.isMac()) {
            MacKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Set the default font.
        defineDefaultFont(uiDefaults);

        // Override some of the Synth UI delegates with copied and modified
        // versions.
        useOurUIs();

        defineBaseColors(uiDefaults);
        defineDefaultBorders(uiDefaults);
        defineArrowButtons(uiDefaults);
        defineButtons(uiDefaults);
        defineComboBoxes(uiDefaults);
        defineDesktopPanes(uiDefaults);
        defineInternalFrames(uiDefaults);
        defineInternalFrameMenuButtons(uiDefaults);
        defineInternalFrameCloseButtons(uiDefaults);
        defineInternalFrameIconifyButtons(uiDefaults);
        defineInternalFrameMaximizeButton(uiDefaults);
        defineLists(uiDefaults);
        defineMenus(uiDefaults);
        definePanels(uiDefaults);
        definePopups(uiDefaults);
        defineProgressBars(uiDefaults);
        defineRootPanes(uiDefaults);
        defineSeparators(uiDefaults);
        defineSpinners(uiDefaults);
        defineScrollBars(uiDefaults);
        defineScrollPane(uiDefaults);
        defineSliders(uiDefaults);
        defineSplitPanes(uiDefaults);
        defineTabbedPanes(uiDefaults);
        defineTables(uiDefaults);
        defineTextControls(uiDefaults);
        defineToolBars(uiDefaults);
        defineTrees(uiDefaults);
        defineToolTips(uiDefaults);
        defineOptionPane(uiDefaults);
        defineFileChooser(uiDefaults);

        if (!PlatformUtils.isMac()) {
            uiDefaults.put("MenuBar[Enabled].backgroundPainter", null);
            uiDefaults.put("MenuBar[Enabled].borderPainter", null);

            // If we're not on a Mac, draw our own title bar.
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);
        } else {

            // If we're on a Mac, use the screen menu bar.
            System.setProperty("apple.laf.useScreenMenuBar", "true");

            // If we're on a Mac, use Aqua for some things.
            defineAquaSettings(uiDefaults);
        }
    }

    return uiDefaults;
}
 
Example 18
/**
 * {@inheritDoc}
 */
@Override public UIDefaults getDefaults() {
    if (uiDefaults == null){
        // Detect platform
        String osName = getSystemProperty("os.name");
        boolean isWindows = osName != null && osName.contains("Windows");

        // We need to call super for basic's properties file.
        uiDefaults = super.getDefaults();
        defaults.initializeDefaults(uiDefaults);

        // Install Keybindings
        if (isWindows) {
            WindowsKeybindings.installKeybindings(uiDefaults);
        } else {
            GTKKeybindings.installKeybindings(uiDefaults);
        }

        // Add Titled Border
        uiDefaults.put("TitledBorder.titlePosition",
                TitledBorder.ABOVE_TOP);
        uiDefaults.put("TitledBorder.border", new BorderUIResource(
                new LoweredBorder()));
        uiDefaults.put("TitledBorder.titleColor",
                getDerivedColor("text",0.0f,0.0f,0.23f,0,true));
        uiDefaults.put("TitledBorder.font",
                new NimbusDefaults.DerivedFont("defaultFont",
                        1f, true, null));

        // Choose Dialog button positions
        uiDefaults.put("OptionPane.isYesLast", !isWindows);

        // Store Table ScrollPane Corner Component
        uiDefaults.put("Table.scrollPaneCornerComponent",
                new UIDefaults.ActiveValue() {
                    @Override
                    public Object createValue(UIDefaults table) {
                        return new TableScrollPaneCorner();
                    }
                });

        // Setup the settings for ToolBarSeparator which is custom
        // installed for Nimbus
        uiDefaults.put("ToolBarSeparator[Enabled].backgroundPainter",
                new ToolBarSeparatorPainter());

        // Populate UIDefaults with a standard set of properties
        for (String componentKey : COMPONENT_KEYS) {
            String key = componentKey+".foreground";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"textForeground"));
            }
            key = componentKey+".background";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"background"));
            }
            key = componentKey+".font";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"font"));
            }
            key = componentKey+".disabledText";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                               "textForeground"));
            }
            key = componentKey+".disabled";
            if (!uiDefaults.containsKey(key)){
                uiDefaults.put(key,
                        new NimbusProperty(componentKey,"Disabled",
                                "background"));
            }
        }

        // FileView icon keys are used by some applications, we don't have
        // a computer icon at the moment so using home icon for now
        uiDefaults.put("FileView.computerIcon",
                new LinkProperty("FileChooser.homeFolderIcon"));
        uiDefaults.put("FileView.directoryIcon",
                new LinkProperty("FileChooser.directoryIcon"));
        uiDefaults.put("FileView.fileIcon",
                new LinkProperty("FileChooser.fileIcon"));
        uiDefaults.put("FileView.floppyDriveIcon",
                new LinkProperty("FileChooser.floppyDriveIcon"));
        uiDefaults.put("FileView.hardDriveIcon",
                new LinkProperty("FileChooser.hardDriveIcon"));
    }
    return uiDefaults;
}