Skip to content

Commit

Permalink
better way to fetch click on 'About' menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Querz committed Sep 21, 2018
1 parent 1b28ab9 commit 56866ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/main/java/net/querz/mcaselector/ui/OptionBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class OptionBar extends MenuBar {
private Menu view = menu("View");
private Menu selection = menu("Selection");
private Menu tools = menu("Tools");
private Menu about = menu("About");
private Label about = new Label("About");

private MenuItem open = menuItem("Open");
private MenuItem quit = menuItem("Quit");
Expand All @@ -46,7 +46,6 @@ public OptionBar(TileMap tileMap, Stage primaryStage) {

tileMap.setOnUpdate(this::onUpdate);

getMenus().addAll(file, view, selection, tools, about);
file.getItems().addAll(open, quit);
view.getItems().addAll(
chunkGrid, regionGrid, separator(),
Expand All @@ -58,14 +57,11 @@ exportChunks, delete, separator(),
importSelection, exportSelection, separator(),
clearSelectionCache);
tools.getItems().addAll(filterChunks, changeFields);
about.setOnMouseClicked(e -> Helper.showAboutDialog(tileMap, primaryStage));
Menu aboutMenu = new Menu();
aboutMenu.setGraphic(about);

//add dummy menu item to be able to use listener on showingProperty
about.getItems().add(new MenuItem());
about.showingProperty().addListener((a, oldValue, newValue) -> {
if (newValue) {
Helper.showAboutDialog(tileMap, primaryStage);
}
});
getMenus().addAll(file, view, selection, tools, aboutMenu);

open.setOnAction(e -> Helper.openWorld(tileMap, primaryStage, this));
quit.setOnAction(e -> System.exit(0));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

/* menu text color and check-menu icon */
.menu >.label, .menu-item >.label, .check-menu-item {
.menu .label, .menu-item >.label, .check-menu-item {
-fx-text-fill: -color-text-light;
-fx-focused-mark-color: -color-check-menu-item-enabled;
-fx-mark-color: -color-check-menu-item-enabled;
Expand Down

0 comments on commit 56866ec

Please sign in to comment.