List of usage examples for javax.swing UIManager getLookAndFeelDefaults
public static UIDefaults getLookAndFeelDefaults()
From source file:Main.java
/** * Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class. * /*from w w w.j a v a2 s. c o m*/ * @param className * fully qualified name of the class of interest * @return the UIDefaults of the class named */ public static UIDefaults getUIDefaultsOfClass(String className) { UIDefaults retVal = new UIDefaults(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); List<?> listKeys = Collections.list(defaults.keys()); for (Object key : listKeys) { if (key instanceof String && ((String) key).startsWith(className)) { String stringKey = (String) key; String property = stringKey; if (stringKey.contains(".")) { //$NON-NLS-1$ property = stringKey.substring(stringKey.indexOf(".") + 1); //$NON-NLS-1$ } retVal.put(property, defaults.get(key)); } } return retVal; }
From source file:Main.java
/** * Convenience method for retrieving a subset of the UIDefaults pertaining * to a particular class.//from w ww. j a v a 2 s. c om * * @param className * fully qualified name of the class of interest * @return the UIDefaults of the class named */ public static UIDefaults getUIDefaultsOfClass(final String className) { final UIDefaults retVal = new UIDefaults(); final UIDefaults defaults = UIManager.getLookAndFeelDefaults(); final List<?> listKeys = Collections.list(defaults.keys()); for (final Object key : listKeys) { if (key instanceof String && ((String) key).startsWith(className)) { final String stringKey = (String) key; String property = stringKey; if (stringKey.contains(".")) { property = stringKey.substring(stringKey.indexOf(".") + 1); } retVal.put(property, defaults.get(key)); } } return retVal; }
From source file:Main.java
/** * Adjust all fonts for displaying to the given size. * <br>Use with care!//from w w w . java 2 s . c om */ public static void setUIFontSize(final int size) { final java.util.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 = ifont.deriveFont((float) size); UIManager.put(key, ofont); } } }
From source file:mergedoc.Application.java
/** * ? Look & Feel ???/* w w w .ja va 2 s . com*/ * @throws ClassNotFoundException LookAndFeel ???????? * @throws InstantiationException ???????????? * @throws IllegalAccessException ???????????? * @throws UnsupportedLookAndFeelException lnf.isSupportedLookAndFeel() ? false ?? */ private static void initSystemLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); Toolkit.getDefaultToolkit().setDynamicLayout(true); // Windows ??? String osName = System.getProperty("os.name", ""); if (osName.indexOf("Windows") != -1) { Object propoFont = new FontUIResource("MS UI Gothic", Font.PLAIN, 12); Object fixedFont = new FontUIResource("MS Gothic", Font.PLAIN, 12); // ?????????? // ????? instanceof FontUIResource ? // ???UIDefaults ? Lazy Value ?????? for (Object keyObj : UIManager.getLookAndFeelDefaults().keySet()) { String key = keyObj.toString(); if (key.endsWith("font") || key.endsWith("Font")) { UIManager.put(key, propoFont); } } // ????? UIManager.put("OptionPane.messageFont", fixedFont); UIManager.put("TextPane.font", fixedFont); UIManager.put("TextArea.font", fixedFont); } }
From source file:jflowmap.JFlowMapApplet.java
public JFlowMapApplet() { instantiated = true;//ww w .j ava2 s .c o m if (!JFlowMapMain.IS_OS_MAC) { SwingUtils.initNimbusLF(); UIDefaults defaults = UIManager.getLookAndFeelDefaults(); // defaults.put("Panel.background", new Color(0xf0, 0xf0, 0xf0)); // defaults.put("TabbedPane.background", new Color(0xf0, 0xf0, 0xf0)); defaults.put("background", new Color(0xf0, 0xf0, 0xf0)); defaults.put("defaultFont", new Font("Arial", Font.PLAIN, 14)); } blockingGlassPane = new BlockingGlassPane(); setGlassPane(blockingGlassPane); blockingGlassPane.setVisible(false); }
From source file:com.haulmont.cuba.desktop.sys.vcl.CollapsiblePanel.java
private Font getTitleFont() { UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); if (lafDefaults.getFont("CollapsiblePanel.font") != null) { // take it from desktop theme return lafDefaults.getFont("CollapsiblePanel.font"); }/*ww w . jav a 2s.com*/ return lafDefaults.getFont("Panel.font"); }
From source file:com.haulmont.cuba.desktop.theme.impl.DesktopThemeImpl.java
protected void initUIDefaults() { for (String propertyName : uiDefaults.keySet()) { UIManager.getLookAndFeelDefaults().put(propertyName, uiDefaults.get(propertyName)); }/* w w w . ja va 2s . c o m*/ }
From source file:com.eviware.soapui.support.components.JPropertiesTable.java
private Font getUIDefaultFont() { UIDefaults uidefs = UIManager.getLookAndFeelDefaults(); for (Object key : uidefs.keySet()) { if (uidefs.get(key) instanceof Font) { return uidefs.getFont(key); }//from ww w . j a v a 2 s . co m } return null; }
From source file:net.sf.keystore_explorer.gui.CreateApplicationGui.java
private static void setDefaultSize(int size) { Set<Object> keySet = UIManager.getLookAndFeelDefaults().keySet(); Object[] keys = keySet.toArray(new Object[keySet.size()]); for (Object key : keys) { if (key != null && key.toString().toLowerCase().contains("font")) { Font font = UIManager.getDefaults().getFont(key); if (font != null) { font = font.deriveFont((float) size); UIManager.put(key, font); }/*w ww . ja va 2 s. c o m*/ } } }
From source file:com.haulmont.cuba.desktop.sys.DesktopToolTipManager.java
protected int getMaxTooltipWidth() { UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults(); int maxTooltipWidth = lafDefaults.getInt("Tooltip.maxWidth"); if (maxTooltipWidth == 0) { maxTooltipWidth = DesktopComponentsHelper.TOOLTIP_WIDTH; }/*from ww w .j av a 2 s. c om*/ return maxTooltipWidth; }