gpt4 book ai didi

java - 无法让 Darkula 在 Netbeans 中以外观和感觉工作

转载 作者:行者123 更新时间:2023-12-02 02:33:47 26 4
gpt4 key购买 nike

我遇到的问题是我已将 Darkula 插件安装到 Netbeans 中。这改变了编辑器应有的方式。我已将其设置为首选外观和感觉,但在运行应用程序时,它不使用 Darkula 主题,仅使用 nimbus。我只能让它使用 Nimbus 或 Windows。

在下面的代码中,我将 Nimbus 更改为 Darkula,但它不起作用。

try{
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Darkula".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}

//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException ex){
System.out.println(ex.toString());
}

最佳答案

方法UIManager.getInstalledLookAndFeels()只会返回系统已知的L&F。如果您有外部 L&F,则需要通过类名来调用它。对于您的情况:

UIManager.setLookAndFeel(new DraculaLaf());

UIManager.setLookAndFeel(DraculaLaf.class.getName());

关于java - 无法让 Darkula 在 Netbeans 中以外观和感觉工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46706437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com