JavaFX action handler for MenuItem does nothing (FXML) -


here menu.fxml:

<?xml version="1.0" encoding="utf-8"?>  <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?>  <stackpane xmlns:fx="http://javafx.com/fxml/1"  fx:controller="biblereader.control.menucontroller">     <menubar fx:id="menu">         <menus>             <menu text="file" fx:id="filemenu">                 <items>                     <menuitem text="open..." fx:id="open" onaction="#handleopenaction" />                     <menuitem text="exit"    fx:id="exit" onaction="#handleexitaction" />                 </items>             </menu>             <menu text="results" fx:id="resultsmenu">                 <items>                     <menuitem text="save results" />                     <menuitem text="load results" />                 </items>             </menu>         </menus>     </menubar>  </stackpane> 

and here menucontroller.java:

package biblereader.control;  import java.net.url; import java.util.resourcebundle; import javafx.application.platform; import javafx.event.actionevent; import javafx.fxml.fxml; import javafx.fxml.initializable; import javafx.scene.control.menu; import javafx.scene.control.menubar; import javafx.scene.control.menuitem;  /**  * fxml controller class  *  * @author nathan  */ public class menucontroller implements initializable {     @fxml private menubar menu;     @fxml private menu test;     @fxml private menuitem open;     @fxml private menuitem exit;      /**      * initializes controller class.      * @param url      * @param rb      */     @override     public void initialize(url url, resourcebundle rb) {         // todo     }          @fxml     private void handleexitaction(actionevent event) {         system.out.println("exiting");         system.exit(0);         platform.exit();     }      @fxml     private void handleopenaction(actionevent event) {         system.out.println("open bible");     } } 

i've tried several different methods make action events trigger, nothing i've done (through fxml) has accomplished action event triggering.

the menu displays fine, nothing happens on menu item clicks.

and yes, have tried doing following well, in controller:

exit = new menuitem("exit");     exit.setonaction((actionevent e) -> {     system.exit(0); }); 

still, nothing have tried has worked. on immensely appreciated.

as roland pointed out, there error elsewhere came refactoring issues.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -