bulenkov / Darcula

Darcula Look and Feel
Apache License 2.0
723 stars 114 forks source link

Support dark title bars on macOS Mojava 10.14 #49

Open freeasbird opened 5 years ago

freeasbird commented 5 years ago

The Darcula theme is cool. Is there a simple way to support dark title on new macOS dark mode? I know IntelliJ IDEA use special setting (Appearance -> "Use dark window header" ) to support the feature. Hope built-in Darcula theme can support the feature. I hope the Darcula theme will be more professional and simple to configure. :) Maybe useful links: http://www.java2s.com/Tutorials/Java/Swing_How_to/JFrame/Change_the_color_of_titlebar_in_JFrame.htm https://bugs.openjdk.java.net/browse/JDK-8181910

hendriks73 commented 5 years ago

If you are using the regular OpenJDK, you need to wait until https://bugs.openjdk.java.net/browse/JDK-8214131 is fixed. Alternatively, you can use a JetBrains JDK from https://bintray.com/jetbrains/intellij-jdk/openjdk8-osx-x64 (or perhaps https://bintray.com/jetbrains/intellij-jdk/openjdk9-osx-x64 , but I have not tried v9 yet).

To enable dark title bars set this client property on your JFrame or JDialog, i.e. on your RootPaneContainer:

public static final String JETBRAINS_AWT_WINDOW_DARK_APPEARANCE = "jetbrains.awt.windowDarkAppearance";
JFrame window = ...
window.getRootPane().putClientProperty(JETBRAINS_AWT_WINDOW_DARK_APPEARANCE, true);
freeasbird commented 5 years ago

Thank you for your reply @hendriks73 With the JDK solution, each Jframe or jdialog will write the special code again, that isn't good solution. :))))

I mean , is there a way let the Darcula wrap the special code or other simple way. Or use a fake title: f.setUndecorated(true); f.getRootPane().setWindowDecorationStyle(......); .......

It's just a suggestion for the project, it's not an issue for Darcula itself. :)