如何在NetBeans GUI Designer Preview中更改外观?

使用NetBeans GUI Builder时,“预览设计”function会显示具有系统外观的面板(例如Windows)。 现在我想用不同的LaF预览我的面板,以获得正确的所有间隙和空间。 有没有办法告诉gui建设者用不同的LaF显示面板?

我唯一能找到的是:

Inspector > 右键单击JFrame > 预览设计

在此处输入图像描述

写在你的主要:

try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception ex) { ex.printStackTrace(); } 

使用预览设计更改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); } 

如果你愿意,你可以编辑整个设计师的外观……

/etc/netbeans.conf ,将以下内容附加到netbeans_default_options设置:

 --laf de.muntjak.tinylookandfeel.TinyLookAndFeel --cp:p path\to\tinylaf.jar" 

(用TinyLAF代替你正在使用的wahtever LAF)

您可以通过以下方式更改预览:工具 – 选项其他选项卡Windows选项卡外观:首选外观。

这样,IDE的外观也会发生变化。