Revision as of 05:02, 23 November 2010 by Han84 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
/**
 * 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.equals("windows")) {
		name = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
	} else if (name.equals("motif")) {
		name = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
	}
	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());
}


Back to JavaHowTo

Alumni Liaison

Sees the importance of signal filtering in medical imaging

Dhruv Lamba, BSEE2010