如何在Swing应用程序中使用Java获取macOS Mojave Style Dark Mode?

问题描述 投票:1回答:2

我想知道是否有一些方法可以在Java的swing应用程序中获得macOS Mojave样式的Dark Mode?

我想在Java Swing应用程序中的JFrame上获取macOS Mojave Style Dark Mode。

请告诉我。

谢谢

巴希尔歌的秘密

java macos macos-mojave
2个回答
1
投票

我想,你可以尝试使用Darcula:

https://github.com/Revivius/nb-darcula

https://github.com/bulenkov/Darcula

import com.bulenkov.darcula.*;
...
...
BasicLookAndFeel darculaLookAndFeel = new DarculaLaf();
try {
  UIManager.setLookAndFeel(darculaLookAndFeel);
} catch (UnsupportedLookAndFeelException ex) {
  // ups!
}

enter image description here


0
投票

要获得黑暗的标题栏,请使用选项-NSRequiresAquaSystemAppearance False启动。例如:

java -jar myapp.jar -NSRequiresAquaSystemAppearance False
       #  ("false", "no" or "0" will also work)

注意:许多解决方案建议编辑Info.plist文件,但这些解决方案对我不起作用。

警告:一些框架can crash as a result of forcing this所以谨慎使用。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.