List of usage examples for javax.swing UIManager getSystemLookAndFeelClassName
public static String getSystemLookAndFeelClassName()
LookAndFeel
class that implements the native system look and feel if there is one, otherwise the name of the default cross platform LookAndFeel
class. From source file:LookAndFeelPrefs.java
/** * Get the desired look and feel from a per-user preference. If the * preferences doesn't exist or is unavailable, use the default look and feel. * The preference is shared by all classes in the same package as prefsClass. *///from w ww.j a v a 2 s . c o m public static void setPreferredLookAndFeel(Class prefsClass) { Preferences prefs = Preferences.userNodeForPackage(prefsClass); String defaultLAF = UIManager.getSystemLookAndFeelClassName(); String laf = prefs.get(PREF_NAME, defaultLAF); try { UIManager.setLookAndFeel(laf); } catch (Exception e) { // ClassNotFound or InstantiationException // An exception here is probably caused by a bogus preference. // Ignore it silently; the user will make do with the default LAF. } }
From source file:br.usp.poli.lta.cereda.macro.util.DisplayUtils.java
/** * Inicializa a classe de exibio, definindo o tema das janelas. */// ww w .j av a 2s .c o m public static void init() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exception) { logger.error("Ocorreu um erro: {}", exception.getMessage()); } }
From source file:net.sourceforge.happybank.main.BankMain.java
/** * launch the application, parsing any command lines *//* ww w. j a v a2 s . c o m*/ public static void main(String[] args) { // force System look and feel try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception exc) { System.err.println("Error loading look and feel: " + exc); } // fire up the program BankMain admin = new BankMain(); admin.frame.setVisible(true); }
From source file:Main.java
/** * Workaround for Bug#5063999.//from w ww .j a v a2 s .co m */ public static void installDefaults() { String defaultlaf = System.getProperty("swing.defaultlaf"); if (defaultlaf == null || defaultlaf.length() == 0) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException ex) { // NO-OP } } JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); UIManager.put(FORMATTED_TEXTFIELD_FONT_KEY, UIManager.get(TEXTFIELD_FONT_KEY)); UIManager.put(FORMATTED_TEXTFIELD_INACTIVE_BACKGROUND_KEY, UIManager.get(TEXTFIELD_INACTIVE_BACKGROUND_KEY)); UIManager.put(PASSWORDFIELD_FONT_KEY, UIManager.get(TEXTFIELD_FONT_KEY)); // try { // UIManager.put(LafWidget.TABBED_PANE_PREVIEW_PAINTER, // new DefaultTabPreviewPainter() { // // /** // * {@inheritDoc} // */ // @Override // public TabOverviewKind getOverviewKind(JTabbedPane tabPane) { // return TabOverviewKind.ROUND_CAROUSEL; // // return TabOverviewKind.MENU_CAROUSEL; // } // }); // UIManager.put(LafWidget.COMPONENT_PREVIEW_PAINTER, // new DefaultPreviewPainter()); // UIManager.put(LafWidget.TEXT_EDIT_CONTEXT_MENU, Boolean.TRUE); // // UIManager.put(LafWidget.COMBO_BOX_NO_AUTOCOMPLETION, Boolean.TRUE); // } catch (Throwable ignored) { // // substance may not be available. // } }
From source file:mergedoc.Application.java
/** * ? Look & Feel ???/*from w w w . j a v a 2 s .c om*/ * @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:UIUtilities.java
/** * Set up the user interface./* ww w. j av a2 s .c om*/ */ public static void setupUI() { try { final String classname = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(classname); } catch (Exception e) { e.printStackTrace(); } final UIDefaults defaults = UIManager.getDefaults(); defaults.put("PopupMenu.border", new BorderUIResource.EtchedBorderUIResource(EtchedBorder.RAISED, defaults.getColor("controlShadow"), defaults.getColor("controlLtHighlight"))); final MatteBorder matteborder = new MatteBorder(1, 1, 1, 1, Color.black); final EmptyBorder emptyborder = new MatteBorder(2, 2, 2, 2, defaults.getColor("control")); final BorderUIResource.CompoundBorderUIResource compBorder = new BorderUIResource.CompoundBorderUIResource( emptyborder, matteborder); final BorderUIResource.EmptyBorderUIResource emptyBorderUI = new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0); defaults.put("SplitPane.border", emptyBorderUI); defaults.put("Table.scrollPaneBorder", emptyBorderUI); defaults.put("ComboBox.border", compBorder); defaults.put("TextField.border", compBorder); defaults.put("TextArea.border", compBorder); defaults.put("CheckBox.border", compBorder); defaults.put("ScrollPane.border", emptyBorderUI); }
From source file:com.shadwelldacunha.byteswipe.core.Utilities.java
public static void setLookAndFeel() { //TODO: Handle exceptions gracefully try {/* w ww . ja v a 2 s . c om*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } }
From source file:Main.java
/** * Prepares the theme. The theme can be overridden with the specified environment variable. The default is the * system look and feel./*from ww w. j av a 2 s. com*/ * * @param overrideEnvVar * The environment variable to check for override value. Specify null for don't use override variable * @throws Exception * When setting the theme failed */ public static void prepareTheme(final String overrideEnvVar) throws Exception { final String sysThemeStr = overrideEnvVar == null ? null : System.getenv().get(overrideEnvVar); System.setProperty("apple.laf.useScreenMenuBar", "true"); if (sysThemeStr == null || Boolean.parseBoolean(sysThemeStr)) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } }
From source file:org.astrojournal.AJMain.java
/** * Start AJMainGUI./*from www. ja v a 2 s . c o m*/ * * @param generator * The generator * @param config * The configuration */ private static void startAJMainGUI(final Generator generator, final Configuration config) { // Note Nimbus does not seem to show the vertical scroll bar if there is // too much text.. try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { log.error(ex, ex); } // enable anti-aliased text: System.setProperty("awt.useSystemAAFontSettings", "gasp"); System.setProperty("swing.aatext", "true"); java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { new AJMainGUI(generator, config).setVisible(true); } }); }
From source file:captor.app.CaptorGui.java
protected static void installLookAndFeel(Model model) { boolean useConfiguredLNF = false; UIManager.LookAndFeelInfo[] installed = UIManager.getInstalledLookAndFeels(); try {// www. j a va2 s . com for (LookAndFeelInfo lnf : installed) { String name = lnf.getClassName(); if (name.equals(model.getConfig().getGuiConfig().getLookAndFeel())) { useConfiguredLNF = true; break; } } if (useConfiguredLNF) { try { UIManager.setLookAndFeel(model.getConfig().getGuiConfig().getLookAndFeel()); } catch (Exception e) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch (Exception e) { System.out.println("Cannot install look and feel."); } }