public static double getJavaVersion() {
		String javaVersion = System.getProperty("java.version");
		double version = Double.parseDouble(javaVersion.substring(0, 3));
		return version;
	}
	

	public static void setLookAndFeel(String lookAndFeelName) {
		if (getJavaVersion() > 1.5) {
			try {
				LookAndFeelInfo[] plafs = UIManager.getInstalledLookAndFeels();
			    for (LookAndFeelInfo info : plafs) {
			    	if (info.getName().equals(lookAndFeelName)) {
			    		UIManager.setLookAndFeel(info.getClassName());
			    	}
			    }
			} catch (Exception pe) {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
				} catch (Exception ce) {
					ce.printStackTrace();
				}
			}
		}
		
	}
	
	public static void setLookAndFeel(String lookAndFeelName, JComponent component) {
		if (getJavaVersion() > 1.5) {
			try {
				LookAndFeelInfo[] plafs = UIManager.getInstalledLookAndFeels();
			    for (LookAndFeelInfo info : plafs) {
			    	if (info.getName().equals(lookAndFeelName)) {
			    		UIManager.setLookAndFeel(info.getClassName());
			    		SwingUtilities.updateComponentTreeUI(component);
			    		break;
			    	}
			    }
			} catch (Exception pe) {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
				} catch (Exception ce) {
					ce.printStackTrace();
				}
			}
		}
	}

Swing Look And Feel JRE(Java Runtime Environment) 1.6 이상 지원이 된다.


기본적으로 JRE 1.6 이상 지원이 되는 Look And Feel에는

Metal, Nimbus, CDE/Motif, Windows, Windows Classic


Writing....

블로그 이미지

행복그리고..

,