當前位置: 首頁>>代碼示例>>Java>>正文


Java UIDefaults類代碼示例

本文整理匯總了Java中javax.swing.UIDefaults的典型用法代碼示例。如果您正苦於以下問題:Java UIDefaults類的具體用法?Java UIDefaults怎麽用?Java UIDefaults使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UIDefaults類屬於javax.swing包,在下文中一共展示了UIDefaults類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDefaults

import javax.swing.UIDefaults; //導入依賴的package包/類
@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;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:24,代碼來源:RapidLookAndFeel.java

示例2: initBorderDefaults

import javax.swing.UIDefaults; //導入依賴的package包/類
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);
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:22,代碼來源:RapidLookAndFeel.java

示例3: addCustomEntriesToTable

import javax.swing.UIDefaults; //導入依賴的package包/類
@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);



}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:21,代碼來源:DemoMetalTheme.java

示例4: addCustomEntriesToTable

import javax.swing.UIDefaults; //導入依賴的package包/類
@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);


}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:ContrastMetalTheme.java

示例5: createValue

import javax.swing.UIDefaults; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:29,代碼來源:NimbusLookAndFeel.java

示例6: installKeyboardActions

import javax.swing.UIDefaults; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:XTextAreaPeer.java

示例7: configureScrollBarColors

import javax.swing.UIDefaults; //導入依賴的package包/類
@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");

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:XTextAreaPeer.java

示例8: main

import javax.swing.UIDefaults; //導入依賴的package包/類
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");
        }
    });
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:21,代碼來源:WrongBackgroundColor.java

示例9: main

import javax.swing.UIDefaults; //導入依賴的package包/類
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");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:26,代碼來源:Test8039750.java

示例10: appSetup

import javax.swing.UIDefaults; //導入依賴的package包/類
/**
 * 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();
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:71,代碼來源:AppSetup.java

示例11: UIDefaultsTableModel

import javax.swing.UIDefaults; //導入依賴的package包/類
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);
        }
    }
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:17,代碼來源:DefaultsDisplay.java

示例12: installBorder

import javax.swing.UIDefaults; //導入依賴的package包/類
@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);
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:19,代碼來源:LuckRootPaneUIBundle.java

示例13: addCustomEntriesToTable

import javax.swing.UIDefaults; //導入依賴的package包/類
@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);

}
 
開發者ID:marvertin,項目名稱:geokuk,代碼行數:18,代碼來源:ContrastTheme.java

示例14: getCustomGradientTable

import javax.swing.UIDefaults; //導入依賴的package包/類
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;
}
 
開發者ID:workcraft,項目名稱:workcraft,代碼行數:18,代碼來源:SilverOceanTheme.java

示例15: buildInstructionDisplay

import javax.swing.UIDefaults; //導入依賴的package包/類
/** 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;
}
 
開發者ID:Meerkat007,項目名稱:Java-Swing-Projects,代碼行數:20,代碼來源:a1.java


注:本文中的javax.swing.UIDefaults類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。