Rol*_*der 15 java swing netbeans gui-builder
使用NetBeans GUI Builder时,"预览设计"功能会显示具有系统外观的面板(例如Windows).现在我想用不同的LaF预览我的面板,以获得正确的所有间隙和空间.有没有办法告诉gui建设者用不同的LaF显示面板?
小智 6
使用预览设计更改 LaF 不会改变外观。它只会向您展示外观,但如果您想更改它,您必须转到源代码然后查找此代码,如果您没有找到它,请单击 + 符号并将 Windows 一词更改为您喜欢的任何内容 注意:您必须更改它才能使所有 jframe 正常工作
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(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
Run Code Online (Sandbox Code Playgroud)
如果您愿意,您可以编辑整个设计师的外观......
在 中<netbeans_home>/etc/netbeans.conf,将以下内容附加到netbeans_default_options设置中:
--laf de.muntjak.tinylookandfeel.TinyLookAndFeel --cp:p path\to\tinylaf.jar"
Run Code Online (Sandbox Code Playgroud)
(用 TinyLAF 替换您正在使用的任何 LAF)
小智 5
写在你的主要:
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception ex) {
ex.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
51493 次 |
| 最近记录: |