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 setNimbusLookAndFeel() { try {/* www. j av a2 s .c om*/ for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } }
From source file:de.dmarcini.submatix.pclogger.gui.MainCommGUI.java
/** * Launch the application.//w w w. java 2 s .c o m * * @param args */ public static void main(String[] args) { StartSplashWindow splashWin = null; Thread tr = null; // // Kommandozeilenargumente parsen // try { if (!parseCliOptions(args)) { System.err.println("Error while scanning CLI-Args...."); System.exit(-1); } } catch (Exception ex2) { System.err.println("Error while scanning CLI-Args...."); System.err.println(ex2.getLocalizedMessage()); System.exit(-1); } // // So, hier knnte ich splashen, alle "gefhrlichen" Sachen sind erledigt // splashWin = new StartSplashWindow(); tr = new Thread(splashWin); tr.start(); try { Thread.sleep(500); } catch (InterruptedException ex1) { } // // GUI starten // EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getLookAndFeel()); // Set cross-platform Java L&F (also called "Metal") UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException ex) { System.out.print("fallback to standart look an feel.."); } catch (ClassNotFoundException ex) { System.out.print("fallback to standart look an feel.."); } catch (InstantiationException ex) { System.out.print("fallback to standart look an feel.."); } catch (IllegalAccessException ex) { System.out.print("fallback to standart look an feel.."); } try { // // das Mainobjekt erzeugen // MainCommGUI window = new MainCommGUI(); window.frmMainWindow.setVisible(true); } catch (Exception e) { System.err.println("Exception: " + e.getLocalizedMessage() + "\n"); e.printStackTrace(); } } }); splashWin.terminate(); }
From source file:Main.java
/** * Tries to set the NimbusLookAndFeel/*from w w w . j ava 2s .c om*/ * * @return if the NimbusLookAndFeel could bet set */ public static boolean setNimbusLookAndFeel() { boolean isNumbusSet = true; try { // Nimbus Loyout UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (ClassNotFoundException e) { isNumbusSet = false; } catch (InstantiationException e) { isNumbusSet = false; } catch (IllegalAccessException e) { isNumbusSet = false; } catch (UnsupportedLookAndFeelException e) { isNumbusSet = false; } return isNumbusSet; /* * try {//alternative way for (LookAndFeelInfo info : * UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { * UIManager.setLookAndFeel(info.getClassName()); break; } } } catch * (UnsupportedLookAndFeelException e) { } catch (ClassNotFoundException e) { } catch * (InstantiationException e) { } catch (IllegalAccessException e) { } */ }
From source file:Main.java
public static void applyLookAndFeel(String lookAndFeel) { try {//from w ww.j a v a 2 s. com for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (lookAndFeel.equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { throw new RuntimeException(e); } }
From source file:Main.java
public static void setSystemLookAndFeel() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
From source file:Main.java
/** * Set the look and feel of the Swing toolkit to emulate the platform it is * currently running on. I implemented this only because I utterly detest * the Metal L&F that is unfortunately default. *//*w w w . j a v a 2 s. c o m*/ public static void setNativeLookAndFeel() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { // If this fails, we begrudgingly allow Swing to use its Metal L&F. } }
From source file:Main.java
public static void setNimbusLookAndFeel() { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (ClassNotFoundException e) { e.printStackTrace();/*from w ww . j av a 2 s . co m*/ } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } break; } } }
From source file:Main.java
/** * Set the look and feel of the specified component to the style of the * current system.//from ww w .j a va 2 s.c o m * * @param c * the specified component */ public static void setSystemLookAndFeel(Component c) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(c); c.validate(); } catch (Exception e) { e.printStackTrace(); } }
From source file:codeswarm.ui.MainView.java
/** * This is the main entry-point. It sets the native Look&Feel, creates and * shows the MainView.// w w w . ja v a 2 s. c o m * @param args the command line arguments. The first parameter * will be passed to {@link code_swarm}. It specifies the config-file. */ public static void main(final String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Toolkit.getDefaultToolkit().setDynamicLayout(true); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { logger.warn("Trouble loading system look and feel. No biggie...", e); } new MainView(args).setVisible(true); } }); }
From source file:Main.java
public static void lookLinux(Component comp) { UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo look : looks) { if (look.getClassName().matches("(?i).*linux.*")) { try { UIManager.setLookAndFeel(look.getClassName()); SwingUtilities.updateComponentTreeUI(comp); return; } catch (Exception e) { e.printStackTrace();/* w ww . j a v a 2 s . com*/ } } } }