如何设置jframe外观 [英] How to set jframe look and feel
本文介绍了如何设置jframe外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对把它放在哪里感到困惑:
I am kind of confused on where to put this :
try {
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch(Exception e){
}
I没有扩展 JFrame
类,但使用 JFrame f = new JFrame();
谢谢:D
I did not extend the JFrame
class but used JFrame f = new JFrame();
Thanks :D
推荐答案
最常见的地方是,在你的静态void main(String [] args)方法中。
如下所示:
Most common place to put this, is right inside your static void main(String[] args) method. Like so:
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch(Exception ignored){}
new YourClass(); //start your application
}
了解更多信息请看这个网站:
http://docs.oracle.com/javase/tutorial/uiswing /lookandfeel/plaf.html
for more info look at this site: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
这篇关于如何设置jframe外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文