ITeye博客

java界面风格

JMaCan · 2010-05-17 15:58 · 编程语言 · Markdown

java的原始界面真的惨不忍睹,不过我们可以通过以下简单的方法使界面的视觉效果发生质的改变O(∩_∩)O~~~

在主界面类前导入:

import javax.swing.UIManager;

在public static void main(String args){}中粘贴如下代码:

try {
             UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			 //UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
			 //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
			 //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
			 //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
		}
		catch(Exception e){
			 e.printStackTrace();
		}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。