List of usage examples for javax.swing UIManager get
public static Object get(Object key)
From source file:jshm.gui.GuiUtil.java
/** * This sets the default L&F as well as sets some icons *///from ww w.j a va 2s . c o m public static void init() { try { // Set the Look & Feel to match the current system UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } // http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingaJOptionPaneLookandFeel.htm UIManager.put("OptionPane.errorIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete.png"))); UIManager.put("OptionPane.informationIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/infoabout.png"))); UIManager.put("OptionPane.questionIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/help.png"))); UIManager.put("OptionPane.warningIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/pause.png"))); UIManager.put("OptionPane.yesIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/accept32.png"))); UIManager.put("OptionPane.noIcon", new ImageIcon(GuiUtil.class.getResource("/jshm/resources/images/toolbar/delete32.png"))); float scale = Config.getFloat("font.scale"); if (1f != scale) { LOG.finest("setting ui font scale to + " + scale); Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource f = (FontUIResource) value; f = new FontUIResource(f.deriveFont(scale * f.getSize2D())); UIManager.put(key, f); } } } // hook into the wizard displayer System.setProperty("WizardDisplayer.default", "jshm.gui.wizards.displayer.WizardDisplayerImpl"); }
From source file:com.haulmont.cuba.desktop.theme.impl.DesktopThemeImpl.java
protected void initButtonsKeyBinding() { InputMap im = (InputMap) UIManager.get("Button.focusInputMap"); im.put(KeyStroke.getKeyStroke("ENTER"), "pressed"); im.put(KeyStroke.getKeyStroke("released ENTER"), "released"); }
From source file:UndoDrawing.java
public static Action getRedoAction(UndoManager manager) { return new RedoAction(manager, (String) UIManager.get("AbstractUndoableEdit.redoText")); }
From source file:edu.ku.brc.af.ui.db.ViewBasedDisplayFrame.java
@Override public void createUI() { setBackground(viewBasedPanel.getBackground()); JScrollPane scrollPane = UIHelper.createScrollPane(viewBasedPanel, true); scrollPane.setBorder(BorderFactory.createLineBorder(getBackground(), 8)); contentPanel = scrollPane;//from www. ja v a2 s . com super.createUI(); viewBasedPanel.setOkCancelBtns(okBtn, cancelBtn); Integer width = (Integer) UIManager.get("ScrollBar.width"); if (width == null) { width = (new JScrollBar()).getPreferredSize().width; } Dimension dim1 = getPreferredSize(); dim1.height += width * 2; if (!UIHelper.isMacOS()) { dim1.width += width; } setSize(dim1); if (cancelBtn != null) { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { cancelBtn.doClick(); } }); } else if (okBtn != null) { okBtn.setEnabled(true); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { okBtn.doClick(); } }); } viewBasedPanel.setOkCancelBtns(okBtn, cancelBtn); addAL(okBtn); addAL(cancelBtn); addAL(applyBtn); addAL(helpBtn); }
From source file:com.limegroup.gnutella.gui.themes.setters.SubstanceThemeSetter.java
public void apply() { SubstanceLookAndFeel.setSkin(_skinClassName); ThemeMediator.applyCommonSkinUI();/*ww w .ja v a 2 s .c om*/ float scaledFontPolicyFactor = WINDOWS_SCALED_FONT_POLICY_FACTOR; if (OSUtils.isMacOSX()) { scaledFontPolicyFactor = MAC_SCALED_FONT_POLICY_FACTOR; } else if (OSUtils.isLinux()) { scaledFontPolicyFactor = LINUX_SCALED_FONT_POLICY_FACTOR; } if (LookUtils.IS_OS_WINDOWS) { fixWindowsOSFont(); } else if (LookUtils.IS_OS_LINUX) { fixLinuxOSFont(); } SubstanceLookAndFeel.setFontPolicy(SubstanceFontUtilities.getScaledFontPolicy(scaledFontPolicyFactor)); //reduceFont("Label.font"); //reduceFont("Table.font"); //ResourceManager.setFontSizes(-1); //ResourceManager.setFontSizes(0); UIManager.put("Tree.leafIcon", UIManager.getIcon("Tree.closedIcon")); // remove split pane borders UIManager.put("SplitPane.border", BorderFactory.createEmptyBorder()); if (!OSUtils.isMacOSX()) { UIManager.put("Table.focusRowHighlightBorder", UIManager.get("Table.focusCellHighlightBorder")); } UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createEmptyBorder(1, 1, 1, 1)); // Add a bold text version of simple text. Font normal = UIManager.getFont("Table.font"); FontUIResource bold = new FontUIResource(normal.getName(), Font.BOLD, normal.getSize()); UIManager.put("Table.font.bold", bold); UIManager.put("Tree.rowHeight", 0); }
From source file:MainProgram.MainProgram.java
public static void setUIFont(javax.swing.plaf.FontUIResource f) { java.util.Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof javax.swing.plaf.FontUIResource) { UIManager.put(key, f); }//ww w . j a va 2 s. c om } }
From source file:org.jdal.swing.form.FormUtils.java
private static int getMnemonic(String key) { String value = (String) UIManager.get(key); if (value == null) { return 0; }//from w ww . j ava 2s . c om try { return Integer.parseInt(value); } catch (NumberFormatException nfe) { } return 0; }
From source file:NwFontChooserS.java
static public void setDefaultFont(Font f) { FontUIResource fui = new FontUIResource(f); Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) UIManager.put(key, fui); }//from w ww. j av a 2 s . com }
From source file:edu.ku.brc.ui.skin.SkinItem.java
/** * @param nm/*from ww w. java 2 s .c o m*/ */ public void pushFG(final String nm) { if (fgColor != null) { if (cacheHash == null) { cacheHash = new Hashtable<String, Object>(); } cacheHash.put(nm, UIManager.get(nm)); UIManager.put(nm, new ColorUIResource(fgColor)); } }
From source file:UI.MainUI.java
public static void setUIFont(javax.swing.plaf.FontUIResource f) { java.util.Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value != null && value instanceof javax.swing.plaf.FontUIResource) UIManager.put(key, f); }// w w w . j a va 2 s .c o m }