List of usage examples for javax.swing UIManager put
public static Object put(Object key, Object value)
From source file:Main.java
public static void disablePaintSliderValue() { UIManager.put("Slider.paintValue", false); }
From source file:Main.java
public static void setApplicationFont(Font font) { ////from w ww .ja va2 s . c om // sets the default font for all Swing components. // UIDefaults defaults = UIManager.getDefaults(); // Enumeration keys = defaults.keys(); // while (keys.hasMoreElements()) { // Object key = keys.nextElement(); // // if ((key instanceof String) && (((String) key).endsWith(".font"))) { // defaults.put(key, font); // } // } // UIManager.put("Button.font", font); // UIManager.put("ToggleButton.font", font); // UIManager.put("RadioButton.font", font); // UIManager.put("CheckBox.font", font); // UIManager.put("ColorChooser.font", font); UIManager.put("ComboBox.font", font); UIManager.put("Label.font", font); UIManager.put("List.font", font); // UIManager.put("MenuBar.font", font); // UIManager.put("MenuItem.font", font); // UIManager.put("RadioButtonMenuItem.font", font); // UIManager.put("CheckBoxMenuItem.font", font); // UIManager.put("Menu.font", font); // UIManager.put("PopupMenu.font", font); // UIManager.put("OptionPane.font", font); // UIManager.put("Panel.font", font); // UIManager.put("ProgressBar.font", font); // UIManager.put("ScrollPane.font", font); // UIManager.put("Viewport.font", font); UIManager.put("TabbedPane.font", font); UIManager.put("Table.font", font); UIManager.put("TableHeader.font", font); UIManager.put("TextField.font", font); UIManager.put("PasswordField.font", font); UIManager.put("TextArea.font", font); UIManager.put("TextPane.font", font); UIManager.put("EditorPane.font", font); // UIManager.put("TitledBorder.font", font); // UIManager.put("ToolBar.font", font); // UIManager.put("ToolTip.font", font); UIManager.put("Tree.font", font); }
From source file:Main.java
/** * Sets all used fonts for displaying to the specified font df * <br>Use with care! /*from w w w . ja v a 2s. c om*/ */ public static void setUIFont(final Font df) { setUIFontSize(df.getSize()); final Enumeration<Object> keys = UIManager.getLookAndFeelDefaults().keys(); while (keys.hasMoreElements()) { final Object key = keys.nextElement(); final Object value = UIManager.get(key); if (value instanceof Font) { final Font ifont = (Font) value; final Font ofont = new FontUIResource(df.getName(), ifont.getStyle(), df.getSize()); UIManager.put(key, ofont); } } }
From source file:dnd.LocationSensitiveDemo.java
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); increaseFont("Tree.font"); increaseFont("Label.font"); increaseFont("ComboBox.font"); increaseFont("List.font"); } catch (Exception e) { }// w ww .ja v a2 s.c o m //Turn off metal's use of bold fonts UIManager.put("swing.boldMetal", Boolean.FALSE); createAndShowGUI(); } }); }
From source file:Main.java
public static void setTheme() { final Color color = new Color(85, 142, 119); final Color colorBackground = new Color(247, 247, 247); Image error_dialog_icon = new ImageIcon("/images/error_dialog.png").getImage(); UIManager.getLookAndFeelDefaults().put("nimbusOrange", color); UIManager.getLookAndFeelDefaults().put("control", colorBackground); UIManager.getLookAndFeelDefaults().put("OptionPane.errorIcon", error_dialog_icon); UIManager.getLookAndFeelDefaults().put("OptionPane.background", colorBackground); UIManager.getLookAndFeelDefaults().put("Panel.background", new Color(245, 245, 245)); UIManager.put("Table.background", new Color(250, 250, 250)); // UIManager.put("Table.alternateRowColor", new Color(159,203,64)); }
From source file:Main.java
public static void increaseDefaultFont(float multiplier) { for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value != null && value instanceof FontUIResource) { FontUIResource fontUIResource = (FontUIResource) value; UIManager.put(key, fontUIResource.deriveFont(fontUIResource.getSize() * multiplier)); }//from w ww .j av a2 s . c om } }
From source file:Main.java
/** * Sets the default UI font style./*from www .j a va 2 s . c o m*/ * * @param fontStyle * The font style * @see Font See Font Javadoc for possible styles */ public static void setUIFontStyle(final int fontStyle) { for (Enumeration<?> en = UIManager.getDefaults().keys(); en.hasMoreElements();) { Object key = en.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource fontRes = (FontUIResource) value; UIManager.put(key, new ProxyLazyValue("javax.swing.plaf.FontUIResource", null, new Object[] { fontRes.getName(), fontStyle, fontRes.getSize() })); } } }
From source file:MainClass.java
public MainClass() { super("Tree Test Example"); setSize(200, 150);//from ww w . j av a 2 s .co m setDefaultCloseOperation(EXIT_ON_CLOSE); UIManager.put("Tree.leafIcon", new ImageIcon("leafIcon.gif")); UIManager.put("Tree.openIcon", new ImageIcon("openIcon.gif")); UIManager.put("Tree.closedIcon", new ImageIcon("closedIcon.gif")); UIManager.put("Tree.expandedIcon", new ImageIcon("expandedIcon.gif")); UIManager.put("Tree.collapsedIcon", new ImageIcon("collapsedIcon")); }
From source file:ColoredToolTipExample.java
public ColoredToolTipExample() { super("Colored ToolTip Example"); UIManager.put("ToolTip.foreground", new ColorUIResource(Color.red)); UIManager.put("ToolTip.background", new ColorUIResource(Color.yellow)); JButton button = new JButton("Hello, world"); button.setToolTipText("Red / Yellow"); getContentPane().add(button);/* w ww .ja va 2 s . com*/ }
From source file:Main.java
public Main() { setSize(300, 100);// w ww.j a v a 2 s.com UIManager.put("ProgressBar.selectionBackground", Color.black); UIManager.put("ProgressBar.selectionForeground", Color.white); UIManager.put("ProgressBar.foreground", new Color(8, 32, 128)); progressBar = new JProgressBar(); progressBar.setMinimum(minValue); progressBar.setMaximum(maxValue); progressBar.setStringPainted(true); JButton start = new JButton("Start"); start.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Thread runner = new Thread() { public void run() { counter = minValue; while (counter <= maxValue) { Runnable runme = new Runnable() { public void run() { progressBar.setValue(counter); } }; SwingUtilities.invokeLater(runme); counter++; try { Thread.sleep(100); } catch (Exception ex) { } } } }; runner.start(); } }); getContentPane().add(progressBar, BorderLayout.CENTER); getContentPane().add(start, BorderLayout.WEST); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }