Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed problem with the default LaF on MacOSX #2384

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
}
}