The application is something like a dictionary. There is a menu of 4 buttons: add, load, delete and exit. After clicking on the first three buttons, a dialog box opens and then loads ... a dictionary. For now, I just bring to the console which button was pressed and here is the problem: when I clicked on add, it shows that all buttons were pressed, when I clicked on download - two, and only when I clicked on delete, it shows that only the delete button was pressed. Add top button, remove bottom button. I can not understand what's wrong. Here is my event handler.
package controllers; import javafx.event.ActionEvent; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; import javafx.stage.Stage; import java.io.IOException; public class menuStageController { enum MenuItem { add, download, delete } private static MenuItem menuItem; public void bAddDictionaryPressed(ActionEvent actionEvent) { menuItem = MenuItem.add; this.dialogStageShow(); } public void bDownloadDictionaryPressed(ActionEvent actionEvent) { menuItem = MenuItem.download; this.dialogStageShow(); } public void bDeleteDictionaryPressed(ActionEvent actionEvent) { menuItem = MenuItem.delete; this.dialogStageShow(); } public void exitAction(ActionEvent actionEvent) { System.exit(0); } public void dialogStageShow() { Stage dialogStage = new Stage(); Parent loadScene = null; try { loadScene = FXMLLoader.load(getClass().getResource("../fxml/dialogStage.fxml")); } catch (IOException e) { e.printStackTrace(); } dialogStage.setScene(new Scene(loadScene)); dialogStage.setResizable(false); dialogStage.show(); } public void dialogStageAction(ActionEvent actionEvent) { switch(menuItem) { case add: System.out.println("Add pressed"); case download: System.out.println("Download pressed"); case delete: System.out.println("Delete pressed"); } } }