Also set OSX properties on main thread, so settings apply properly

(still doesn't work though...)
This commit is contained in:
SiboVG 2024-08-12 22:23:12 +02:00
parent fe162d4abf
commit cc738bbeaf
2 changed files with 18 additions and 6 deletions

View File

@ -89,12 +89,7 @@ final class OSXSetup {
}
log.debug("Setting up OSX UI Elements");
try {
// Put the menu bar at the top of the screen
System.setProperty("apple.laf.useScreenMenuBar", "true");
// Fix window title bar color
System.setProperty("apple.awt.application.appearance", "system");
// Set the name in the menu
System.setProperty("com.apple.mrj.application.apple.menu.about.name", APP_NAME);
setupOSXProperties();
// This line must come AFTER the above properties are set, otherwise
// the name will not appear
@ -125,6 +120,20 @@ final class OSXSetup {
}
}
public static void setupOSXProperties() {
if (SystemInfo.getPlatform() != Platform.MAC_OS) {
log.warn("Attempting to set up OSX properties on non-MAC_OS");
return;
}
// Put the menu bar at the top of the screen
System.setProperty("apple.laf.useScreenMenuBar", "true");
// Fix window title bar color
System.setProperty("apple.awt.application.appearance", "system");
// Set the name in the menu
System.setProperty("com.apple.mrj.application.apple.menu.about.name", APP_NAME);
}
/**
* Sets up the open file handler, which handles file association on macOS.
*/

View File

@ -28,6 +28,9 @@ public class OpenRocket {
private static final String STARTUP_CLASS = "info.openrocket.swing.startup.SwingStartup";
public static void main(String[] args) {
// Set OSX-specific properties
OSXSetup.setupOSXProperties();
// This property works around some fundamental bugs in TimSort in the java library which has had known issues
// since it was introduced in JDK 1.7. In OpenRocket it manifests when you sort the motors in the motor chooser dialog
// by designation.