Java 类javax.swing.UIDefaults 实例源码

项目:rapidminer    文件:RapidLookAndFeel.java   
@Override
public UIDefaults getDefaults() {
    getColors();

    UIDefaults table = new UIDefaults();
    // copy existing default values over
    // enables AntiAliasing if AntiAliasing is enabled in the OS
    // EXCEPT for key "Menu.opaque" which will glitch out JMenues
    UIDefaults lookAndFeelDefaults = UIManager.getLookAndFeelDefaults();
    Hashtable copy = new Hashtable<>(lookAndFeelDefaults);
    for (Object key : copy.keySet()) {
        if (!String.valueOf(key).equals("Menu.opaque")) {
            table.put(key, lookAndFeelDefaults.get(key));
        }
    }

    initClassDefaults(table);
    initSystemColorDefaults(table);
    initComponentDefaults(table);
    COLORS.addCustomEntriesToTable(table);

    return table;
}
项目:rapidminer    文件:RapidLookAndFeel.java   
private void initBorderDefaults(UIDefaults table) {
    Object[] borderDefaults = { "TextField.border", Borders.getTextFieldBorder(), "PasswordField.border",
            Borders.getTextFieldBorder(), "FilterTextField.border", Borders.getTextFieldBorder(),
            "FormattedTextField.border", Borders.getTextFieldBorder(), "TextArea.border", Borders.getTextFieldBorder(),
            "SplitPane.border", Borders.getSplitPaneBorder(), "ScrollPane.border", Borders.getScrollPaneBorder(),
            "InternalFrame.border", Borders.getInternalFrameBorder(), "Table.scrollPaneBorder", null,   // removed
            // table
            // border,
            // original:
            // Borders.getSplitPaneBorder()
            "Table.tabbedPaneBorder", null,   // remove double borders
            "ToolBar.border", Borders.getToolBarBorder(), "Spinner.border", Borders.getSpinnerBorder(),
            "ComboBox.border", Borders.getComboBoxBorder(), "Button.border", Borders.getEmptyButtonBorder(),
            "ToggleButton.border", Borders.getEmptyButtonBorder(), "ProgressBar.border", Borders.getProgressBarBorder(),
            "PopupMenu.border", Borders.getPopupMenuBorder(), "MenuBar.border", Borders.getMenuBarBorder(),
            "CheckBox.border", Borders.getCheckBoxBorder(), "RadioButton.border", Borders.getCheckBoxBorder(),
            "ToolTip.border", Borders.getToolTipBorder(), "CheckBox.icon", IconFactory.getCheckBoxIcon(),
            "RadioButton.icon", IconFactory.getRadioButtonIcon(), "ComboBox.focusCellHighlightBorder",
            Borders.getComboBoxListCellRendererFocusBorder(), };
    table.putDefaults(borderDefaults);
}
项目:OpenJSharp    文件:DemoMetalTheme.java   
@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);



}
项目:OpenJSharp    文件:ContrastMetalTheme.java   
@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);


}
项目:OpenJSharp    文件:NimbusLookAndFeel.java   
/**
 * Creates the value retrieved from the <code>UIDefaults</code> table.
 * The object is created each time it is accessed.
 *
 * @param table a <code>UIDefaults</code> table
 * @return the created <code>Object</code>
 */
@Override
public Object createValue(UIDefaults table) {
    Object obj = null;
    // check specified state
    if (state!=null){
        obj = uiDefaults.get(prefix+"["+state+"]."+suffix);
    }
    // check enabled state
    if (obj==null){
        obj = uiDefaults.get(prefix+"[Enabled]."+suffix);
    }
    // check for defaults
    if (obj==null){
        if (isFont) {
            obj = uiDefaults.get("defaultFont");
        } else {
            obj = uiDefaults.get(suffix);
        }
    }
    return obj;
}
项目:OpenJSharp    文件:XTextAreaPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:OpenJSharp    文件:XTextAreaPeer.java   
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
项目:OpenJSharp    文件:XTextFieldPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:jdk8u-jdk    文件:DemoMetalTheme.java   
@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);



}
项目:jdk8u-jdk    文件:ContrastMetalTheme.java   
@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);


}
项目:jdk8u-jdk    文件:NimbusLookAndFeel.java   
/**
 * Creates the value retrieved from the <code>UIDefaults</code> table.
 * The object is created each time it is accessed.
 *
 * @param table a <code>UIDefaults</code> table
 * @return the created <code>Object</code>
 */
@Override
public Object createValue(UIDefaults table) {
    Object obj = null;
    // check specified state
    if (state!=null){
        obj = uiDefaults.get(prefix+"["+state+"]."+suffix);
    }
    // check enabled state
    if (obj==null){
        obj = uiDefaults.get(prefix+"[Enabled]."+suffix);
    }
    // check for defaults
    if (obj==null){
        if (isFont) {
            obj = uiDefaults.get("defaultFont");
        } else {
            obj = uiDefaults.get(suffix);
        }
    }
    return obj;
}
项目:jdk8u-jdk    文件:XTextAreaPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:jdk8u-jdk    文件:XTextAreaPeer.java   
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
项目:jdk8u-jdk    文件:XTextFieldPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:jdk8u-jdk    文件:WrongBackgroundColor.java   
public static void main(final String[] args)
        throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(() -> {
        UIDefaults ui = UIManager.getDefaults();
        ui.put("control", new ColorUIResource(54, 54, 54));
        final JDialog dialog = new JDialog();
        final JFrame frame = new JFrame();
        frame.pack();
        dialog.pack();
        final Color dialogBackground = dialog.getBackground();
        final Color frameBackground = frame.getBackground();
        frame.dispose();
        dialog.dispose();
        if (!dialogBackground.equals(frameBackground)) {
            System.err.println("Expected:" + frameBackground);
            System.err.println("Actual:" + dialogBackground);
            throw new RuntimeException("Wrong background color");
        }
    });
}
项目:jdk8u-jdk    文件:Test8039750.java   
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
项目:openjdk-jdk10    文件:DemoMetalTheme.java   
@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);



}
项目:openjdk-jdk10    文件:ContrastMetalTheme.java   
@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);


}
项目:openjdk-jdk10    文件:NimbusLookAndFeel.java   
/**
 * Creates the value retrieved from the <code>UIDefaults</code> table.
 * The object is created each time it is accessed.
 *
 * @param table a <code>UIDefaults</code> table
 * @return the created <code>Object</code>
 */
@Override
public Object createValue(UIDefaults table) {
    Object obj = null;
    // check specified state
    if (state!=null){
        obj = uiDefaults.get(prefix+"["+state+"]."+suffix);
    }
    // check enabled state
    if (obj==null){
        obj = uiDefaults.get(prefix+"[Enabled]."+suffix);
    }
    // check for defaults
    if (obj==null){
        if (isFont) {
            obj = uiDefaults.get("defaultFont");
        } else {
            obj = uiDefaults.get(suffix);
        }
    }
    return obj;
}
项目:openjdk-jdk10    文件:XTextAreaPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:openjdk-jdk10    文件:XTextAreaPeer.java   
@Override
protected void configureScrollBarColors() {
    UIDefaults uidefaults = XToolkit.getUIDefaults();
    Color bg = scrollbar.getBackground();
    if (bg == null || bg instanceof UIResource) {
        scrollbar.setBackground(uidefaults.getColor("ScrollBar.background"));
    }

    Color fg = scrollbar.getForeground();
    if (fg == null || fg instanceof UIResource) {
        scrollbar.setForeground(uidefaults.getColor("ScrollBar.foreground"));
    }

    thumbHighlightColor = uidefaults.getColor("ScrollBar.thumbHighlight");
    thumbLightShadowColor = uidefaults.getColor("ScrollBar.thumbShadow");
    thumbDarkShadowColor = uidefaults.getColor("ScrollBar.thumbDarkShadow");
    thumbColor = uidefaults.getColor("ScrollBar.thumb");
    trackColor = uidefaults.getColor("ScrollBar.track");

    trackHighlightColor = uidefaults.getColor("ScrollBar.trackHighlight");

}
项目:openjdk-jdk10    文件:XTextFieldPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:openjdk-jdk10    文件:WrongBackgroundColor.java   
public static void main(final String[] args)
        throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(() -> {
        UIDefaults ui = UIManager.getDefaults();
        ui.put("control", new ColorUIResource(54, 54, 54));
        final JDialog dialog = new JDialog();
        final JFrame frame = new JFrame();
        frame.pack();
        dialog.pack();
        final Color dialogBackground = dialog.getBackground();
        final Color frameBackground = frame.getBackground();
        frame.dispose();
        dialog.dispose();
        if (!dialogBackground.equals(frameBackground)) {
            System.err.println("Expected:" + frameBackground);
            System.err.println("Actual:" + dialogBackground);
            throw new RuntimeException("Wrong background color");
        }
    });
}
项目:openjdk-jdk10    文件:Test8039750.java   
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
项目:scorekeeperfrontend    文件:AppSetup.java   
/**
 * Do some common setup for all applications at startup
 * @param name the application name used for Java logging and database logging
 */
public static void appSetup(String name)
{
    // Set our platform wide L&F 
    System.setProperty("swing.defaultlaf", "javax.swing.plaf.nimbus.NimbusLookAndFeel");
    UIDefaults defaults = UIManager.getLookAndFeelDefaults();
    defaults.put("Table.gridColor", new Color(140,140,140));
    defaults.put("Table.showGrid", true);

    // Set the program name which is used by PostgresqlDatabase to identify the app in logs
    System.setProperty("program.name", name);

    // Start with a fresh root set at warning
    Logger root = LogManager.getLogManager().getLogger("");
    Formatter format = new SingleLineFormatter();

    root.setLevel(Level.WARNING);
    for(Handler handler : root.getHandlers()) {
        root.removeHandler(handler);
    }

    // Set prefs levels before windows preference load barfs useless data on the user
    Logger.getLogger("java.util.prefs").setLevel(Level.SEVERE);
    // postgres JDBC spits out a lot of data even though we catch the exception
    Logger.getLogger("org.postgresql.jdbc").setLevel(Level.OFF);
    Logger.getLogger("org.postgresql.Driver").setLevel(Level.OFF);

    // Add console handler if running in debug mode
    if (Prefs.isDebug()) {
        ConsoleHandler ch = new ConsoleHandler();
        ch.setLevel(Level.ALL);
        ch.setFormatter(format);
        root.addHandler(ch);
    }

    // For our own logs, we can set super fine level or info depending on if debug mode and attach dialogs to those
    Logger applog = Logger.getLogger("org.wwscc");
    applog.setLevel(Prefs.isDebug() ? Level.FINEST : Level.INFO);
    applog.addHandler(new AlertHandler());

    Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {
            applog.log(Level.WARNING, String.format("\bUncaughtException in %s: %s", t, e), e);
        }});

    try {
        File logdir = Prefs.getLogDirectory().toFile();
        if (!logdir.exists())
            if (!logdir.mkdirs())
                throw new IOException("Can't create log directory " + logdir);
        FileHandler fh = new FileHandler(new File(logdir, name+".%g.log").getAbsolutePath(), 1000000, 10, true);
        fh.setFormatter(format);
        fh.setLevel(Level.ALL);
        root.addHandler(fh);
    } catch (IOException ioe) {
        JOptionPane.showMessageDialog(FocusManager.getCurrentManager().getActiveWindow(),
                "Unable to enable logging to file: " + ioe, "Log Error", JOptionPane.ERROR_MESSAGE);
    }

    // force the initialization of IdGenerator on another thread so app can start now without an odd delay later
    new Thread() {
        public void run() {
            IdGenerator.generateId();
        }
    }.start();
}
项目:openjdk9    文件:ContrastMetalTheme.java   
@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);


}
项目:littleluck    文件:DefaultsDisplay.java   
public UIDefaultsTableModel() {
    // make a local copy of the defaults table in case the look and feel changes
    defaults = new UIDefaults();
    keys = new ArrayList<Object>();
    UIDefaults realDefaults = UIManager.getDefaults();
    Enumeration keysEnum = realDefaults.keys();
    while (keysEnum.hasMoreElements()) {
        Object key = keysEnum.nextElement();
        if (!defaults.containsKey(key)) {
            keys.add(key);
            defaults.put(key, realDefaults.get(key));
        } else {
            System.out.println("found duplicate key:"+key);
        }
    }
}
项目:openjdk9    文件:NimbusLookAndFeel.java   
/**
 * Creates the value retrieved from the <code>UIDefaults</code> table.
 * The object is created each time it is accessed.
 *
 * @param table a <code>UIDefaults</code> table
 * @return the created <code>Object</code>
 */
@Override
public Object createValue(UIDefaults table) {
    Object obj = null;
    // check specified state
    if (state!=null){
        obj = uiDefaults.get(prefix+"["+state+"]."+suffix);
    }
    // check enabled state
    if (obj==null){
        obj = uiDefaults.get(prefix+"[Enabled]."+suffix);
    }
    // check for defaults
    if (obj==null){
        if (isFont) {
            obj = uiDefaults.get("defaultFont");
        } else {
            obj = uiDefaults.get(suffix);
        }
    }
    return obj;
}
项目:openjdk9    文件:XTextAreaPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:openjdk9    文件:XTextFieldPeer.java   
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
项目:openjdk9    文件:WrongBackgroundColor.java   
public static void main(final String[] args)
        throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(() -> {
        UIDefaults ui = UIManager.getDefaults();
        ui.put("control", new ColorUIResource(54, 54, 54));
        final JDialog dialog = new JDialog();
        final JFrame frame = new JFrame();
        frame.pack();
        dialog.pack();
        final Color dialogBackground = dialog.getBackground();
        final Color frameBackground = frame.getBackground();
        frame.dispose();
        dialog.dispose();
        if (!dialogBackground.equals(frameBackground)) {
            System.err.println("Expected:" + frameBackground);
            System.err.println("Actual:" + dialogBackground);
            throw new RuntimeException("Wrong background color");
        }
    });
}
项目:lookaside_java-1.8.0-openjdk    文件:Test8039750.java   
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
项目:openjdk9    文件:Test8039750.java   
public static void main(String[] args) {
    UIDefaults table= new MetalLookAndFeel().getDefaults();
    test(table.get("ToolBar.rolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("ToolBar.nonrolloverBorder"),
            "javax.swing.plaf.metal.MetalBorders$ButtonBorder",
            "javax.swing.plaf.metal.MetalBorders$RolloverMarginBorder");
    test(table.get("RootPane.frameBorder"),
            "javax.swing.plaf.metal.MetalBorders$FrameBorder");
    test(table.get("RootPane.plainDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.informationDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$DialogBorder");
    test(table.get("RootPane.errorDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder");
    test(table.get("RootPane.colorChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.fileChooserDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.questionDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
    test(table.get("RootPane.warningDialogBorder"),
            "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder");
}
项目:Java8CN    文件:NimbusLookAndFeel.java   
/**
 * Creates the value retrieved from the <code>UIDefaults</code> table.
 * The object is created each time it is accessed.
 *
 * @param table a <code>UIDefaults</code> table
 * @return the created <code>Object</code>
 */
@Override
public Object createValue(UIDefaults table) {
    Object obj = null;
    // check specified state
    if (state!=null){
        obj = uiDefaults.get(prefix+"["+state+"]."+suffix);
    }
    // check enabled state
    if (obj==null){
        obj = uiDefaults.get(prefix+"[Enabled]."+suffix);
    }
    // check for defaults
    if (obj==null){
        if (isFont) {
            obj = uiDefaults.get("defaultFont");
        } else {
            obj = uiDefaults.get(suffix);
        }
    }
    return obj;
}
项目:lookaside_java-1.8.0-openjdk    文件:DemoMetalTheme.java   
@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);



}
项目:littleluck    文件:LuckRootPaneUIBundle.java   
@Override
protected void installBorder(UIDefaults table)
{
    // 初始化阴影边框
    Insets insets = new Insets(5, 5, 5, 5);
    BufferedImage shadowImg = LuckRes.getImage("frame/shadow_border.9.png");
    Border shadowBorder = getBorderRes(new LuckNinePatchBorder(insets, shadowImg));

    // 设置窗体、弹窗边框配置
    table.put(FRAME_BORDER, shadowBorder);
    table.put(PLAINDIALOG_BORDER, shadowBorder);
    table.put(INFORMATIONDIALOG_BORDER, shadowBorder);
    table.put(ERRORDIALOG_BORDER, shadowBorder);
    table.put(COLORCHOOSERDIALOG_BORDER, shadowBorder);
    table.put(FILECHOOSERDIALOG_BORDER, shadowBorder);
    table.put(QUESTIONDIALOG_BORDER, shadowBorder);
    table.put(WARNINGDIALOG_BORDER, shadowBorder);
}
项目:geokuk    文件:ContrastTheme.java   
@Override
public void addCustomEntriesToTable(final UIDefaults table) {

    final Border blackLineBorder = new BorderUIResource(new LineBorder(getBlack()));

    final Object textBorder = new BorderUIResource(new CompoundBorder(blackLineBorder, new BasicBorders.MarginBorder()));

    table.put("ToolTip.border", blackLineBorder);
    table.put("TitledBorder.border", blackLineBorder);

    table.put("TextField.border", textBorder);
    table.put("PasswordField.border", textBorder);
    table.put("TextArea.border", textBorder);
    table.put("TextPane.border", textBorder);
    table.put("EditorPane.border", textBorder);

}
项目:workcraft    文件:SilverOceanTheme.java   
private Object[] getCustomGradientTable(UIDefaults table) {
    List<Serializable> buttonGradient = Arrays.asList(1.0, 0.0, getSecondary3(), getSecondary2(), getSecondary2());

    Object[] result = {
            "Button.gradient", buttonGradient,
            "CheckBox.gradient", buttonGradient,
            "CheckBoxMenuItem.gradient", buttonGradient,
            "InternalFrame.activeTitleGradient", buttonGradient,
            "RadioButton.gradient", buttonGradient,
            "RadioButtonMenuItem.gradient", buttonGradient,
            "ScrollBar.gradient", buttonGradient,
            "Slider.focusGradient", buttonGradient,
            "Slider.gradient", buttonGradient,
            "ToggleButton.gradient", buttonGradient,
    };
    return result;
}
项目:Java-Swing-Projects    文件:a1.java   
/** Create the display that shows instruction */
public JTextPane buildInstructionDisplay(String instructionText)
{
    JTextPane instructionDisplay = new JTextPane();

    UIDefaults defaults = new UIDefaults();
    defaults.put("TextPane[Enabled].backgroundPainter", MAIN_BACKGROUND_COLOR);
    instructionDisplay.putClientProperty("Nimbus.Overrides", defaults);
    instructionDisplay.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
    instructionDisplay.setBackground(MAIN_BACKGROUND_COLOR);

    instructionDisplay.setEditable(false);
    instructionDisplay.setPreferredSize(new Dimension(200, 100));
    instructionDisplay.setContentType("text/html");
    instructionText = this.setHTMLTextProperties(instructionText, KioskFrame.INSTRUCTION_TEXT_FONT_SIZE, KioskFrame.INSTRUCTION_TEXT_FONT_FACE, "<center>", KioskFrame.INSTRUCTION_FONT_COLOR);
    instructionDisplay.setText(instructionText);

    return instructionDisplay;
}
项目:lookaside_java-1.8.0-openjdk    文件:ContrastMetalTheme.java   
@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);


}