List of usage examples for javax.swing UIManager setLookAndFeel
@SuppressWarnings("deprecation") public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
From source file:Main.java
public static void setLookAndFeel() { try {/*from w w w . j a v a 2 s .c o m*/ UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); } catch (Exception e) { // Likely PlasticXP is not in the class path; ignore. } }
From source file:Main.java
public static void setSystemLookAndFeel() { try {/*from ww w.ja v a2s. com*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:Main.java
public static void setSystemLookAndFeel() { try {/*from ww w .ja v a 2 s. co m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (final Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void setLookAndFeel(String lafName, JFrame frame) { try {//from w ww . j a v a2s . c o m UIManager.setLookAndFeel(lafName); if (frame != null) { SwingUtilities.updateComponentTreeUI(frame); frame.pack(); } } catch (ClassNotFoundException e) { System.err.println("Could not find Look and Feel class!"); e.printStackTrace(); } catch (InstantiationException e) { System.err.println("Could not instantiate Look and Feel class!"); e.printStackTrace(); } catch (IllegalAccessException e) { System.err.println("Could not access Look and Feel class!"); e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { System.err.println("This Look and Feel is not supported!"); e.printStackTrace(); } }
From source file:Main.java
public static void setLookAndFeelToSystem() { try {//from w w w . ja v a2 s. co m UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } }
From source file:Main.java
public static void setLookAndFeelToDefault() { try {/*from ww w. j av a2s .c o m*/ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } }
From source file:Main.java
public static void updateUILookAndFeel(Component c) { try {/* w w w . j a v a2s . c o m*/ String plafName = UIManager.getInstalledLookAndFeels()[1].getClassName(); UIManager.setLookAndFeel(plafName); SwingUtilities.updateComponentTreeUI(c); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Set up default Windows look and feel if available; * otherwise, ignore and do nothing./*from w w w . j av a 2 s. c o m*/ */ public static void setWindowsLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ignore) { } }
From source file:Main.java
public static void setLookAndFeel(int fontSize) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIDefaults defaults = UIManager.getDefaults(); Enumeration<Object> keys = defaults.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); if ((key instanceof String) && (((String) key).endsWith(".font"))) { FontUIResource font = (FontUIResource) UIManager.get(key); defaults.put(key, new FontUIResource(font.getFontName(), font.getStyle(), fontSize)); }/* ww w .j av a2 s . c om*/ } }
From source file:Main.java
/** * Apply System Look and Feel to current program. *///from w w w . j a va 2 s . c om public static void setSystemLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (UnsupportedLookAndFeelException e) { } }