我正在使用Eclipse中的WindowBuilder编写程序。我希望能够得到有关如何将设计(外观和感觉)从Metal更改为Windows的帮助。我该怎么做?谢谢
我正在使用Eclipse中的WindowBuilder编写程序。我希望能够得到有关如何将设计(外观和感觉)从Metal更改为Windows的帮助。我该怎么做?谢谢
Swing调用如下:
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
System.out.println("Error setting native LAF: " + e);
}
我曾尝试在首选项中设置WIndow Builder使用系统外观,但仍然不起作用,但simgineer的解决方案有效。我会在simgineer的帖子中添加特定的代码添加位置,以及应该使用的标签,以便从Window Builder解析器隐藏代码。在您的主应用程序窗口中...
public static void main(String[] args) {
// hide>>$
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
System.out.println("Error setting native LAF: " + e);
}
// $hide<<$
EventQueue.invokeLater(new Runnable() {
public void run() {
// generated code ...
}
});
}
干杯
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(BiatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(BiatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(BiatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(BiatApp.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}