【发布时间】:2012-04-06 20:08:00
【问题描述】:
我已经在我的 java 应用程序中设置了外观和感觉 nimbus,但我不知道为什么视图总是从一帧到另一帧不同。在一个框架中,我得到了非常好的蓝色光轮,而在另一个框架中,我得到了灰色的,但这不合适。另一个没有显示为使用 nimbus 外观。这是我在 main 中使用的代码
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
我也导入
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;
希望有人能帮帮我,谢谢。
【问题讨论】:
-
如果您使用
java -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel MyApp运行应用程序是否可以正常工作(请参阅:docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html)
标签: java swing look-and-feel nimbus