diff --git a/src/main/java/es/kauron/jstudy/controller/Controller.java b/src/main/java/es/kauron/jstudy/controller/Controller.java index 7e0168d..3068a4b 100644 --- a/src/main/java/es/kauron/jstudy/controller/Controller.java +++ b/src/main/java/es/kauron/jstudy/controller/Controller.java @@ -16,6 +16,8 @@ import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; +import javafx.scene.control.Menu; +import javafx.scene.control.MenuBar; import javafx.scene.control.MenuItem; import javafx.scene.control.*; import javafx.scene.image.Image; @@ -54,6 +56,9 @@ public class Controller implements Initializable { @FXML private MenuItem menuCloseTab, menuSave, menuUndo, menuRedo; + @FXML + private MenuBar menuBar; + private final BooleanProperty tabIsTable = new SimpleBooleanProperty(false); private final Map tabMap = new HashMap<>(); private String updateURL, updateFileName; @@ -96,9 +101,26 @@ public class Controller implements Initializable { } }) ); + // Do not show icons in the menu items of the main menu in macOS. + Platform.runLater(() -> { + if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) + for (Menu m : menuBar.getMenus()) + removeIcon(m); + }); new Thread(this::checkUpdate).start(); } + private void removeIcon(Menu menu) { + menu.setGraphic(null); + for (MenuItem item : menu.getItems()) { + if (item instanceof Menu) { + removeIcon((Menu) item); + } else { + item.setGraphic(null); + } + } + } + private boolean isTableTab(Tab tab) { return tabMap.containsKey(tab) && tabMap.get(tab) instanceof TableController; } diff --git a/src/main/resources/es/kauron/jstudy/view/main.fxml b/src/main/resources/es/kauron/jstudy/view/main.fxml index e14fa96..bb0267b 100644 --- a/src/main/resources/es/kauron/jstudy/view/main.fxml +++ b/src/main/resources/es/kauron/jstudy/view/main.fxml @@ -86,7 +86,7 @@ - +