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


Java UIDefaults.put方法代碼示例

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


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

示例1: 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

示例2: 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

示例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: loadResourceBundle

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/**
 * Loads the resource bundle in 'resources/basic' and adds the contained
 * key/value pairs to the <code>defaults</code> table.
 *
 * @param defaults the UI defaults to load the resources into
 */
// FIXME: This method is not used atm and private and thus could be removed.
// However, I consider this method useful for providing localized
// descriptions and similar stuff and therefore think that we should use it
// instead and provide the resource bundles.
private void loadResourceBundle(UIDefaults defaults)
{
  ResourceBundle bundle;
  Enumeration e;
  String key;
  String value;
  bundle = ResourceBundle.getBundle("resources/basic");
  // Process Resources
  e = bundle.getKeys();
  while (e.hasMoreElements())
    {
      key = (String) e.nextElement();
      value = bundle.getString(key);
      defaults.put(key, value);
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:27,代碼來源:BasicLookAndFeel.java

示例6: buildPermitPrintPanel

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/** Create a panel that display text after the user has confirmed purchase and started printing the permit. */
public void buildPermitPrintPanel()
{
	JTextPane infoDisplay = new JTextPane();
	infoDisplay.setOpaque(false);
	UIDefaults defaults = new UIDefaults();
	defaults.put("TextPane[Enabled].backgroundPainter", MAIN_BACKGROUND_COLOR);
	infoDisplay.putClientProperty("Nimbus.Overrides", defaults);
	infoDisplay.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
	infoDisplay.setBackground(MAIN_BACKGROUND_COLOR);
	infoDisplay.setContentType("text/html");
	infoDisplay.setText(String.format("<html><center><font face=%s size=%s color=%s>%s</font></center>", KioskFrame.PERMIT_PRINT_FONT_FACE, KioskFrame.PERMIT_PRINT_FONT_SIZE, KioskFrame.PERMIT_PRINT_FONT_COLOR, KioskFrame.PERMIT_PRINT_TEXT));
	
	//Add icon by Pan
	JLabel iconLogo = new JLabel();
	Icon icon = new ImageIcon("print_permit_logo.png");
	iconLogo.setIcon(icon);
	
	this.permitPrintPanel = new JPanel(new GridBagLayout());
	permitPrintPanel.setBackground(KioskFrame.MAIN_BACKGROUND_COLOR);
	permitPrintPanel.add(iconLogo, this.createGridBagConstraints(0, 0, 1));
	permitPrintPanel.add(infoDisplay, this.createGridBagConstraints(0, 1, 1));	
}
 
開發者ID:Meerkat007,項目名稱:Java-Swing-Projects,代碼行數:24,代碼來源:a1.java

示例7: buildPayParkingFinePanel

import javax.swing.UIDefaults; //導入方法依賴的package包/類
public JPanel buildPayParkingFinePanel()
{
	JPanel panel = new JPanel();
	panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	
	this.payParkingFineTextDisplay = new JTextPane();
	this.payParkingFineTextDisplay.setEditable(false);
	UIDefaults defaults = new UIDefaults();
	defaults.put("TextPane[Enabled].backgroundPainter", MAIN_BACKGROUND_COLOR);
	this.payParkingFineTextDisplay.putClientProperty("Nimbus.Overrides", defaults);
	this.payParkingFineTextDisplay.putClientProperty("Nimbus.Overrides.InheritDefaults", true);
	this.payParkingFineTextDisplay.setBackground(KioskFrame.MAIN_BACKGROUND_COLOR);
	this.payParkingFineTextDisplay.setContentType("text/html");
	String text = this.setHTMLTextProperties(KioskFrame.PARKING_FINE_PAYMENT_QUESTION, KioskFrame.WARNING_FONT_SIZE, KioskFrame.INSTRUCTION_TEXT_FONT_FACE, "<justify>", KioskFrame.INSTRUCTION_FONT_COLOR);
	this.payParkingFineTextDisplay.setText(text);
	
	JPanel yesNoButtonContainer = this.buildParkingFinePaymentYesNoButtonPanel();
	
	panel.add(this.payParkingFineTextDisplay);
	panel.add(yesNoButtonContainer);
	return panel;
}
 
開發者ID:Meerkat007,項目名稱:Java-Swing-Projects,代碼行數:24,代碼來源:a1.java

示例8: createView

import javax.swing.UIDefaults; //導入方法依賴的package包/類
private static JTable createView() {
    try {
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/hospitalManagmentSystem", "root", "");
        Statement stmt = conn.createStatement();
        ResultSet resultSet = stmt.executeQuery("SELECT * FROM patients");

        patientRecordsTable = new JTable(buildtableModel(resultSet));
        UIDefaults defaults = UIManager.getLookAndFeelDefaults();
        defaults.put("Table.alternateRowColor", Color.decode("#f5f5f5"));
        patientRecordsTable.setSelectionBackground(Color.decode("#1e90ff"));
        patientRecordsTable.setSelectionForeground(Color.WHITE);
        patientRecordsTable.setRowHeight(30);
        patientRecordsTable.setBackground(Color.WHITE);
        patientRecordsTable.setShowGrid(false);
        patientRecordsTable.setFont(new Font("calibri", Font.PLAIN, 16));
        resultSet.close();
        newTable = patientRecordsTable;

    } catch (SQLException | HeadlessException exc) {
        JOptionPane.showMessageDialog(null, exc);
    }
    return newTable;
}
 
開發者ID:samuelowino,項目名稱:HospitalManagementSystem-JSE8,代碼行數:24,代碼來源:ViewPatientRecordsView.java

示例9: addCustomEntriesToTable

import javax.swing.UIDefaults; //導入方法依賴的package包/類
public void addCustomEntriesToTable(UIDefaults table) {
	super.addCustomEntriesToTable(table);
	// table.put("Button.gradient", Arrays.asList(new Object[] {
	// new Float(.3f), new Float(0f), new ColorUIResource(light_gray),// new
	// // ColorUIResource(0xDDE8F3),
	// new ColorUIResource(new Color(245,245,245)), getSecondary2() }));

	// Color cccccc = new ColorUIResource(0xCCCCCC);
	Color dadada = new ColorUIResource(0xDADADA);
	// Color c8ddf2 = new ColorUIResource(0xC8DDF2);

	List<Object> buttonGradient = Arrays.asList(new Object[] {
			new Float(1f), new Float(0f), getWhite(), dadada,
			new ColorUIResource(dadada) });
	// Arrays.asList(new Object[] {
	// new Float(.3f),
	// new Float(0f),
	// new ColorUIResource(new Color(230, 230, 230)),// new
	// // ColorUIResource(0xDDE8F3),
	// new ColorUIResource(new Color(235, 235, 235)),
	// new ColorUIResource(new Color(180, 180, 180)) });
	table.put("Button.gradient", buttonGradient);

	table.put("ScrollBar.gradient", buttonGradient);

	table.put("RadioButton.gradient", buttonGradient);
	table.put("RadioButtonMenuItem.gradient", buttonGradient);
	// table.put("ScrollBar.gradient", buttonGradient);

	//		
	// table.put("Button.gradient", Arrays.asList(new Object[] {
	// new Float(.3f), new Float(0f), new ColorUIResource(Color.black),//
	// new
	// // ColorUIResource(0xDDE8F3),
	// getWhite(), getSecondary2() }));
	// // System.out.println(table.get("Button.gradient"));
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:38,代碼來源:XDMTheme.java

示例10: installFont

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/**
 * Set the default font in all UI elements.
 *
 * @param defaultFont A {@code Font} to use by default.
 */
public static void installFont(Font defaultFont) {
    UIDefaults u = UIManager.getDefaults();
    java.util.Enumeration<Object> keys = u.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        if (u.get(key) instanceof javax.swing.plaf.FontUIResource) {
            u.put(key, defaultFont);
        }
    }
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:16,代碼來源:FreeColLookAndFeel.java

示例11: addColor

import javax.swing.UIDefaults; //導入方法依賴的package包/類
private void addColor(UIDefaults d, String uin, String parentUin,
        float hOffset, float sOffset, float bOffset,
        int aOffset, boolean uiResource) {
    Color color = getDerivedColor(uin, parentUin,
            hOffset, sOffset, bOffset, aOffset, uiResource);
    d.put(uin, color);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:NimbusDefaults.java

示例12: testInheritance

import javax.swing.UIDefaults; //導入方法依賴的package包/類
void testInheritance() {
    Color defaultColor = label.getBackground();

    // 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);

    // back to default color
    UIManager.put("Label[Enabled].background", null);
    label.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
    label.putClientProperty("Nimbus.Overrides", null);
    check(defaultColor);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:ColorCustomizationTest.java

示例13: editLaF

import javax.swing.UIDefaults; //導入方法依賴的package包/類
public final void editLaF(JTree tree) {
    UIDefaults paneDefaults = new UIDefaults();
    paneDefaults.put("Tree.selectionBackground", null);
    tree.putClientProperty("Nimbus.Overrides", paneDefaults);
    tree.putClientProperty("Nimbus.Overrides.InheritDefaults", false);
    tree.setBackground(Color.WHITE);
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:8,代碼來源:TreeSelectionRenderer.java

示例14: loadImages

import javax.swing.UIDefaults; //導入方法依賴的package包/類
@Override
protected void loadImages(UIDefaults table)
{
    ImageIcon ascIcon = new ImageIcon(LuckRes.getImage("table/asc.png"));

    table.put(ASC_ICON, getIconRes(ascIcon));

    ImageIcon descIcon = new ImageIcon(LuckRes.getImage("table/desc.png"));

    table.put(DESC_ICON, getIconRes(descIcon));
}
 
開發者ID:freeseawind,項目名稱:littleluck,代碼行數:12,代碼來源:LuckTableUIBundle.java

示例15: initComponentDefaults

import javax.swing.UIDefaults; //導入方法依賴的package包/類
@Override
protected void initComponentDefaults( UIDefaults table) {
    super.initComponentDefaults( table);
    
    table.put("Tree.collapsedIcon", DarkMonkeyIconFactory.getTreeCollapsedIcon());
    table.put("Tree.expandedIcon", DarkMonkeyIconFactory.getTreeExpandedIcon());
    // 
    /*
    for( Enumeration en = table.keys(); en.hasMoreElements(); ) {
        System.out.println( "[" + en.nextElement() + "]");
    }
    */
         
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:15,代碼來源:DarkMonkeyLookAndFeel.java


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