Search in sources :

Example 1 with BorderUIResource

use of javax.swing.plaf.BorderUIResource in project adempiere by adempiere.

the class ContrastTheme method addCustomEntriesToTable.

public void addCustomEntriesToTable(UIDefaults table) {
    Border blackLineBorder = new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder = new BorderUIResource(new LineBorder(getWhite()));
    //
    Object textBorder = new BorderUIResource(new CompoundBorder(blackLineBorder, new BasicBorders.MarginBorder()));
    //	Enhancements
    Object[] defaults = new Object[] { "ToolTip.border", blackLineBorder, "TitledBorder.border", blackLineBorder, "TextField.border", textBorder, "PasswordField.border", textBorder, "TextArea.border", textBorder, "TextPane.border", textBorder, "EditorPane.border", textBorder, //
    "ComboBox.background", getWindowBackground(), "ComboBox.foreground", getUserTextColor(), "ComboBox.selectionBackground", getTextHighlightColor(), "ComboBox.selectionForeground", getHighlightedTextColor(), "ProgressBar.foreground", getUserTextColor(), "ProgressBar.background", getWindowBackground(), "ProgressBar.selectionForeground", getWindowBackground(), "ProgressBar.selectionBackground", getUserTextColor(), "OptionPane.errorDialog.border.background", getPrimary1(), "OptionPane.errorDialog.titlePane.foreground", getPrimary3(), "OptionPane.errorDialog.titlePane.background", getPrimary1(), "OptionPane.errorDialog.titlePane.shadow", getPrimary2(), "OptionPane.questionDialog.border.background", getPrimary1(), "OptionPane.questionDialog.titlePane.foreground", getPrimary3(), "OptionPane.questionDialog.titlePane.background", getPrimary1(), "OptionPane.questionDialog.titlePane.shadow", getPrimary2(), "OptionPane.warningDialog.border.background", getPrimary1(), "OptionPane.warningDialog.titlePane.foreground", getPrimary3(), "OptionPane.warningDialog.titlePane.background", getPrimary1(), "OptionPane.warningDialog.titlePane.shadow", getPrimary2() };
    table.putDefaults(defaults);
}
Also used : BorderUIResource(javax.swing.plaf.BorderUIResource) LineBorder(javax.swing.border.LineBorder) CompoundBorder(javax.swing.border.CompoundBorder) CompoundBorder(javax.swing.border.CompoundBorder) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border)

Example 2 with BorderUIResource

use of javax.swing.plaf.BorderUIResource in project jdk8u_jdk by JetBrains.

the class NimbusLookAndFeel method getDefaults.

/**
     * {@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;
}
Also used : UIDefaults(javax.swing.UIDefaults) BorderUIResource(javax.swing.plaf.BorderUIResource)

Example 3 with BorderUIResource

use of javax.swing.plaf.BorderUIResource in project jdk8u_jdk by JetBrains.

the class ContrastMetalTheme method addCustomEntriesToTable.

@Override
public void addCustomEntriesToTable(UIDefaults table) {
    Border blackLineBorder = new BorderUIResource(new LineBorder(getBlack()));
    Border whiteLineBorder = new BorderUIResource(new LineBorder(getWhite()));
    Object textBorder = new BorderUIResource(new CompoundBorder(blackLineBorder, new BasicBorders.MarginBorder()));
    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);
    table.put("Table.focusCellHighlightBorder", whiteLineBorder);
    table.put("Table.focusCellForeground", getWhite());
    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.font", textBorder);
}
Also used : BorderUIResource(javax.swing.plaf.BorderUIResource) LineBorder(javax.swing.border.LineBorder) CompoundBorder(javax.swing.border.CompoundBorder) CompoundBorder(javax.swing.border.CompoundBorder) LineBorder(javax.swing.border.LineBorder) Border(javax.swing.border.Border)

Aggregations

BorderUIResource (javax.swing.plaf.BorderUIResource)3 Border (javax.swing.border.Border)2 CompoundBorder (javax.swing.border.CompoundBorder)2 LineBorder (javax.swing.border.LineBorder)2 UIDefaults (javax.swing.UIDefaults)1