Java Eclipse窗口生成器外观
我通过编写这个应用程序并在WindowBuilder中编辑来学习JavaSwing,但我可以看到,运行它时应用程序的外观与在WindowBuilder中编辑的应用程序不同。具体来说,我更喜欢WindowBuilder中的那个。我在WindowBuilder中检查了某种皮肤,并选择了“Nimbus”。我是否可以制作一些东西,使应用程序在运行时与WindowBuilder中的应用程序相同?我正在使用Eclipse 第一个是在WindowBuilder中测试,第二个是在运行应用程序时测试Java Eclipse窗口生成器外观,java,eclipse,swing,look-and-feel,windowbuilder,Java,Eclipse,Swing,Look And Feel,Windowbuilder,我通过编写这个应用程序并在WindowBuilder中编辑来学习JavaSwing,但我可以看到,运行它时应用程序的外观与在WindowBuilder中编辑的应用程序不同。具体来说,我更喜欢WindowBuilder中的那个。我在WindowBuilder中检查了某种皮肤,并选择了“Nimbus”。我是否可以制作一些东西,使应用程序在运行时与WindowBuilder中的应用程序相同?我正在使用Eclipse 第一个是在WindowBuilder中测试,第二个是在运行应用程序时测试 import
import javax.swing.UIManager.*;
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.
}
您可以在Swing应用程序中激活不同的外观: 我想你正在运行的应用程序中缺少了这一点
import javax.swing.UIManager.*;
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.
}
你的问题已经回答了 在月食中去 窗口>首选项>WindowBuilder>Swing>外观 检查 在main()方法中应用choosen LookAndFeel。很抱歉SS2在这里