sun.swing.plaf.GTKKeybindings Java Examples

The following examples show how to use sun.swing.plaf.GTKKeybindings. 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 File: NimbusLookAndFeel.java    From jdk8u-jdk with 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 #2
Source File: NimbusLookAndFeel.java    From jdk8u-dev-jdk with 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 #3
Source File: SeaGlassLookAndFeel.java    From seaglass with 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 #4
Source File: NimbusLookAndFeel.java    From jdk8u-jdk with 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 File: NimbusLookAndFeel.java    From jdk8u_jdk with 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 #6
Source File: NimbusLookAndFeel.java    From openjdk-8 with 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 #7
Source File: NimbusLookAndFeel.java    From openjdk-8-source with 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 #8
Source File: NimbusLookAndFeel.java    From hottub with 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 #9
Source File: NimbusLookAndFeel.java    From Java8CN with 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 #10
Source File: NimbusLookAndFeel.java    From jdk1.8-source-analysis with 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 #11
Source File: NimbusLookAndFeel.java    From openjdk-jdk9 with 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 #12
Source File: NimbusLookAndFeel.java    From Bytecoder with 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 #13
Source File: NimbusLookAndFeel.java    From openjdk-jdk8u-backup with 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 #14
Source File: NimbusLookAndFeel.java    From openjdk-jdk8u with 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 File: NimbusLookAndFeel.java    From JDKSourceCode1.8 with 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 #16
Source File: NimbusLookAndFeel.java    From jdk8u60 with 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 File: NimbusLookAndFeel.java    From TencentKona-8 with 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 #18
Source File: NimbusLookAndFeel.java    From dragonwell8_jdk with 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;
}