(New page: <source lang="java"> →* * Apply look and feel more easily. * This method has to be called at the first line of main method. * @param name: public static void guiSetLookAndFeel(Strin...) |
|||
Line 6: | Line 6: | ||
*/ | */ | ||
public static void guiSetLookAndFeel(String name) { | public static void guiSetLookAndFeel(String name) { | ||
− | if (name. | + | if (name.equalsIgnoreCase("windows")) { |
name = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; | name = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; | ||
− | } else if (name. | + | } else if (name.equalsIgnoreCase("motif")) { |
name = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; | name = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; | ||
+ | } else if (name.equalsIgnoreCase("nimbus")) { | ||
+ | name = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; | ||
} | } | ||
try { | try { |
Latest revision as of 03:08, 2 December 2010
/** * Apply look and feel more easily. * This method has to be called at the first line of main method. * @param name */ public static void guiSetLookAndFeel(String name) { if (name.equalsIgnoreCase("windows")) { name = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; } else if (name.equalsIgnoreCase("motif")) { name = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (name.equalsIgnoreCase("nimbus")) { name = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; } try { javax.swing.UIManager.setLookAndFeel(name); } catch (ClassNotFoundException ex) { Ts.printErr(ex); } catch (InstantiationException ex) { Ts.printErr(ex); } catch (IllegalAccessException ex) { Ts.printErr(ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { Ts.printErr(ex); } } public static void printErr(java.lang.Exception ex) { printErr(ex.getMessage()); }