|
24 | 24 | import javafx.application.Platform; |
25 | 25 | import javafx.collections.FXCollections; |
26 | 26 | import javafx.event.ActionEvent; |
27 | | -import javafx.event.EventHandler; |
28 | 27 | import javafx.fxml.FXML; |
29 | 28 | import javafx.scene.control.*; |
30 | 29 | import javafx.scene.effect.DropShadow; |
|
34 | 33 | import javafx.scene.paint.Color; |
35 | 34 | import javafx.stage.DirectoryChooser; |
36 | 35 | import javafx.stage.Stage; |
37 | | -import javafx.stage.WindowEvent; |
38 | 36 | import org.json.JSONArray; |
39 | 37 |
|
40 | 38 | import java.awt.Desktop; |
@@ -113,6 +111,9 @@ static void afterStageShowing() { |
113 | 111 | btn.setText("Load " + appPrefs.get("Name Preset" + i, "")); |
114 | 112 | } |
115 | 113 | } |
| 114 | + if (PlatformUtil.isMac()) { |
| 115 | + INSTANCE.useMacOSMenuBar(); |
| 116 | + } |
116 | 117 | checkForUpdates(false); |
117 | 118 | } |
118 | 119 |
|
@@ -187,18 +188,6 @@ public void initialize() { |
187 | 188 | path = path + System.getProperty("file.separator") + "Blobs"; |
188 | 189 | } |
189 | 190 | pathField.setText(path); |
190 | | - |
191 | | - // use macos menu bar or not |
192 | | - if (PlatformUtil.isMac()) { |
193 | | - primaryStage.setOnShowing(new EventHandler<WindowEvent>() { |
194 | | - @Override |
195 | | - public void handle(WindowEvent event) { |
196 | | - useMacOSMenuBar(); |
197 | | - log("using macOS menu bar"); |
198 | | - primaryStage.removeEventHandler(event.getEventType(), this); |
199 | | - } |
200 | | - }); |
201 | | - } |
202 | 191 | } |
203 | 192 |
|
204 | 193 | private static void addListenerToSetNullEffect(TextField... textFields) { |
@@ -663,6 +652,7 @@ private void useMacOSMenuBar() { |
663 | 652 |
|
664 | 653 | // needs to be run with Platform.runLater(), otherwise the application menu doesn't show up |
665 | 654 | Platform.runLater(() -> tk.setGlobalMenuBar(macOSMenuBar)); |
| 655 | + log("using macOS menu bar"); |
666 | 656 | } |
667 | 657 |
|
668 | 658 | public void backgroundSettingsHandler() { |
|
0 commit comments