Skip to content

Commit

Permalink
Fixed problem with the default LaF on MacOSX (#2384)
Browse files Browse the repository at this point in the history
Now uses AquaLookAndFeel and disable FlatLaFLight as it doesn't work on MacOSX
  • Loading branch information
breiler authored Dec 8, 2023
1 parent 36682a1 commit 50ca482
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ This file is part of Universal Gcode Sender (UGS).
*/
package com.willwinder.ugs.nbp.core.lifecycle;

import org.apache.commons.lang3.SystemUtils;
import org.openide.modules.ModuleInstall;
import org.openide.util.NbPreferences;

Expand All @@ -30,9 +31,26 @@ public class LookAndFeelInstaller extends ModuleInstall {

@Override
public void validate() {
if (SystemUtils.IS_OS_MAC_OSX) {
// FlatlLaf look and feel doesn't work on MacOSXs
setMacOSLaF();
} else {
setLaF();
}
}

private void setLaF() {
Preferences prefs = NbPreferences.root().node("laf");
if (prefs.get("laf", "").isBlank()) {
prefs.put("laf", "com.formdev.flatlaf.FlatLightLaf");
}
}
}

private void setMacOSLaF() {
Preferences prefs = NbPreferences.root().node("laf");
String currentLaF = prefs.get("laf", "");
if (currentLaF.isBlank() || currentLaF.equals("com.formdev.flatlaf.FlatLightLaf")) {
prefs.put("laf", "com.apple.laf.AquaLookAndFeel");
}
}
}

0 comments on commit 50ca482

Please sign in to comment.