Java 8 UIDefaults - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 UIDefaults class.

This code example shows how to use the following methods:put
    @Override 
    public void addCustomEntriesToTable(UIDefaults table) {
        super.addCustomEntriesToTable(table);
 
        final int internalFrameIconSize = 22;
        table.put("InternalFrame.closeIcon", MetalIconFactory.
                getInternalFrameCloseIcon(internalFrameIconSize));
        table.put("InternalFrame.maximizeIcon", MetalIconFactory.
                getInternalFrameMaximizeIcon(internalFrameIconSize));
        table.put("InternalFrame.iconifyIcon", MetalIconFactory.
                getInternalFrameMinimizeIcon(internalFrameIconSize));
        table.put("InternalFrame.minimizeIcon", MetalIconFactory.
                getInternalFrameAltMaximizeIcon(internalFrameIconSize));
 
 
        table.put("ScrollBar.width", 21);
 
 
 
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
 
        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);
 
 
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:putDefaults
     * Initializes the Plastic3D component defaults. 
     * 
     * @param table   the UIDefaults table to work with 
     */ 
    protected void initComponentDefaults(UIDefaults table) {
        super.initComponentDefaults(table);
 
        Object menuBarBorder = PlasticBorders.getThinRaisedBorder(); 
        Object toolBarBorder = PlasticBorders.getThinRaisedBorder(); 
 
        Object[] defaults =  { 
            "MenuBar.border",               menuBarBorder, 
            "ToolBar.border",               toolBarBorder, 
        }; 
        table.putDefaults(defaults);
    } 
 
    protected static void installDefaultThemes() {} 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getColor
     * Replaced if (lookAndFeel instanceof NimbusLookAndFeel) as NimbusLookAndFeel is deprecated  
     */ 
    private void initializeColors(LookAndFeel lookAndFeel) {
        lafDefaults = UIManager.getLookAndFeelDefaults();
        if (lookAndFeel instanceof MetalLookAndFeel) {
            WINDOW = lafDefaults.getColor("window");
            WINDOW_BORDER = lafDefaults.getColor("windowBorder");
        } else 
        if(lookAndFeel.getClass().getSimpleName().equalsIgnoreCase("NimbusLookAndFeel")) {
            WINDOW = lafDefaults.getColor("Panel.background");
            WINDOW_BORDER = lafDefaults.getColor("nimbusBorder");
        } else { 
            logger.error("Look and Feel reference is invalid: "
                    + lookAndFeel.getName() + ". MCT is closing.");
            System.exit(1);
        } 
        MENUBAR_BACKGROUND = lafDefaults.getColor("MenuBar.background");
        TREE_SELECTION_BACKGROUND = lafDefaults.getColor("Tree.selectionBackground");
        TEXT_HIGHLIGHT = lafDefaults.getColor("textHighlight");
 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
     */ 
    public static void adaptForNimbus(JEditorPane pane) {
        LookAndFeel currentLAF = UIManager.getLookAndFeel();
        if (currentLAF != null && "Nimbus".equals(currentLAF.getName())) {
            Color bgColor = UIManager.getColor("Label.background");
            UIDefaults defaults = new UIDefaults();
            defaults.put("EditorPane[Enabled].backgroundPainter", bgColor);
            pane.putClientProperty("Nimbus.Overrides", defaults);
            pane.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
            pane.setBackground(bgColor);
        } 
    } 
 
    private static String getFontRule(Font f) {
        return MessageFormat.format(
                "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}", 
                f.getName(),
                f.getSize(),
                "bold", 
                f.isItalic() ? "italic" : "normal"
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:putDefaults
    public ColorUIResource getSimpleInternalFrameBackground() {
        return getWhite(); 
    } 
 
    public void addCustomEntriesToTable(UIDefaults table) {
        super.addCustomEntriesToTable(table);
        Object[] uiDefaults = { 
                "TextField.ineditableForeground", 
                getSoftWhite(), 
                "Plastic.brightenStop", 
                new Color(255, 255, 255, 20), 
                "Plastic.ltBrightenStop", 
                new Color(255, 255, 255, 16), 
                "SimpleInternalFrame.activeTitleBackground", 
                getPrimary2() 
                }; 
        table.putDefaults(uiDefaults);
    } 
 
    public ColorUIResource getControlDisabled() {

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put
 
        // more specific setting is in global defaults 
        UIManager.put("Label[Enabled].background", new ColorUIResource(Color.RED));
 
        // less specific one is in overrides 
        UIDefaults defs = new UIDefaults();
        defs.put("Label.background", new ColorUIResource(Color.GREEN));
 
        // global wins 
        label.putClientProperty("Nimbus.Overrides", defs);
        check(Color.RED);
 
        // now override wins 
        label.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
        check(Color.GREEN);
 
        // global is back 
        label.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
        check(Color.RED);
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put, putDefaults
        } 
        setTheme(myTheme);
    } 
 
    protected void initClassDefaults(UIDefaults table) {
        super.initClassDefaults(table);
        Object[] uiDefaults = { 
            // BaseLookAndFeel classes 
            "LabelUI", BaseLabelUI.class.getName(), 
            "SeparatorUI", BaseSeparatorUI.class.getName(), 
            "TextFieldUI", BaseTextFieldUI.class.getName(), 
            "TextAreaUI", BaseTextAreaUI.class.getName(), 
            "EditorPaneUI", BaseEditorPaneUI.class.getName(), 
            "PasswordFieldUI", BasePasswordFieldUI.class.getName(), 
            "CheckBoxUI", BaseCheckBoxUI.class.getName(), 
            "RadioButtonUI", BaseRadioButtonUI.class.getName(), 
            "SplitPaneUI", BaseSplitPaneUI.class.getName(), 
            "ToolTipUI", BaseToolTipUI.class.getName(), 
            "TreeUI", BaseTreeUI.class.getName(), 
            "TableUI", BaseTableUI.class.getName(), 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put, putDefaults
        } 
        setTheme(myTheme);
    } 
 
    protected void initClassDefaults(UIDefaults table) {
        super.initClassDefaults(table);
        Object[] uiDefaults = { 
            // BaseLookAndFeel classes 
            "ToggleButtonUI", BaseToggleButtonUI.class.getName(), 
            "LabelUI", BaseLabelUI.class.getName(), 
            "SeparatorUI", BaseSeparatorUI.class.getName(), 
            "TextFieldUI", BaseTextFieldUI.class.getName(), 
            "TextAreaUI", BaseTextAreaUI.class.getName(), 
            "EditorPaneUI", BaseEditorPaneUI.class.getName(), 
            "PasswordFieldUI", BasePasswordFieldUI.class.getName(), 
            "CheckBoxUI", BaseCheckBoxUI.class.getName(), 
            "RadioButtonUI", BaseRadioButtonUI.class.getName(), 
            "SplitPaneUI", BaseSplitPaneUI.class.getName(), 
            "ToolTipUI", BaseToolTipUI.class.getName(), 
            "TreeUI", BaseTreeUI.class.getName(), 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:put, putDefaults
        } 
        setTheme(myTheme);
    } 
 
    protected void initClassDefaults(UIDefaults table) {
        super.initClassDefaults(table);
        Object[] uiDefaults = { 
            // BaseLookAndFeel classes 
            "LabelUI", BaseLabelUI.class.getName(), 
            "ToggleButtonUI", BaseToggleButtonUI.class.getName(), 
            "SeparatorUI", BaseSeparatorUI.class.getName(), 
            "TextFieldUI", BaseTextFieldUI.class.getName(), 
            "TextAreaUI", BaseTextAreaUI.class.getName(), 
            "EditorPaneUI", BaseEditorPaneUI.class.getName(), 
            "PasswordFieldUI", BasePasswordFieldUI.class.getName(), 
            "ComboBoxUI", BaseComboBoxUI.class.getName(), 
            "ToolTipUI", BaseToolTipUI.class.getName(), 
            "TreeUI", BaseTreeUI.class.getName(), 
            "TableUI", BaseTableUI.class.getName(), 
            "TableHeaderUI", BaseTableHeaderUI.class.getName(), 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 UIDefaults Methods: