[英]How to change the theme of a Java application in Netbeans?
我想更改Java应用程序的外观。 我只是在使用Netbeans,我不喜欢其中的金属外观,而是想将其更改为Windows外观。 有什么办法吗?
我要使它看起来像这样。
但是,当我运行它时,这就是它的默认外观或主题。
是否有任何步骤可以更改其默认外观?
基本上:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
将外观设置为您的操作系统使用的外观。
看一下这个Java教程 ,它还列出了可用的主题以及如何应用它们。
尝试这个 :
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Metal".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(YourJavaApplicationName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(YourJavaApplicationName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(YourJavaApplicationName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(YourJavaApplicationName.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.