java - Mainapp does not start -
i need debug main app , can't find error. app doesn't start personoverviewcontroller
. need fix issue, in fmxl=
messages in control
javafx.fxml.loadexception: /users/stefanhegetschweiler/documents/weiterbildung/fh/programmierung/projekt/17.08.2014/vokabulartrainer/bin/ch/makery/address/view/personoverview.fxml @ javafx.fxml.fxmlloader.constructloadexception(fxmlloader.java:2617) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2587) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2441) @ javafx.fxml.fxmlloader.load(fxmlloader.java:2409) @ ch.makery.address.mainapp.showpersonoverview(mainapp.java:162) @ ch.makery.address.mainapp.start(mainapp.java:120) @ com.sun.javafx.application.launcherimpl$8.run(launcherimpl.java:837) @ com.sun.javafx.application.platformimpl$7.run(platformimpl.java:335) @ com.sun.javafx.application.platformimpl$6$1.run(platformimpl.java:301) @ com.sun.javafx.application.platformimpl$6$1.run(platformimpl.java:298) @ java.security.accesscontroller.doprivileged(native method) @ com.sun.javafx.application.platformimpl$6.run(platformimpl.java:298) @ com.sun.glass.ui.invokelaterdispatcher$future.run(invokelaterdispatcher.java:95) caused by: java.lang.reflect.invocationtargetexception
personoverviewcontroller
:
package ch.makery.address.view; import javafx.fxml.fxml; import javafx.scene.control.label; import javafx.scene.control.tablecolumn; import javafx.scene.control.tableview; import org.controlsfx.dialog.dialogs; import ch.makery.address.mainapp; import ch.makery.address.model.person; public class personoverviewcontroller { @fxml private tableview<person> persontable; @fxml private tablecolumn<person, string> firstnamecolumn; @fxml private tablecolumn<person, string> lastnamecolumn; @fxml private label firstnamelabel; @fxml private label lastnamelabel; @fxml // reference main application. private mainapp mainapp; /** * constructor. * constructor called before initialize() method. */ public personoverviewcontroller() { } /** * initializes controller class. method automatically called * after fxml file has been loaded. */ @fxml private void initialize() { // initialize person table 2 columns. firstnamecolumn.setcellvaluefactory( celldata -> celldata.getvalue().firstnameproperty()); lastnamecolumn.setcellvaluefactory( celldata -> celldata.getvalue().lastnameproperty()); // clear person details. showpersondetails(null); // listen selection changes , show person details when changed. persontable.getselectionmodel().selecteditemproperty().addlistener( (observable, oldvalue, newvalue) -> showpersondetails(newvalue)); } /** * called main application give reference itself. * * @param mainapp */ public void setmainapp(mainapp mainapp) { this.mainapp = mainapp; // add observable list data table persontable.setitems(mainapp.getpersondata()); } /** * fills text fields show details person. * if specified person null, text fields cleared. * * @param person person or null */ private void showpersondetails(person person) { if (person != null) { // fill labels info person object. firstnamelabel.settext(person.getfirstname()); lastnamelabel.settext(person.getsecondenglish()); } else { // person null, remove text. firstnamelabel.settext(""); lastnamelabel.settext(""); } } /** * called when user clicks on delete button. */ @fxml private void handledeleteperson() { int selectedindex = persontable.getselectionmodel().getselectedindex(); if (selectedindex >= 0) { persontable.getitems().remove(selectedindex); } else { // nothing selected. dialogs.create() .title("no selection") .masthead("no word selected") .message("please select word in table.") .showwarning(); } } /** * called when user clicks new button. opens dialog edit * details new person. */ @fxml private void handlenewperson() { person tempperson = new person(); boolean okclicked = mainapp.showpersoneditdialog(tempperson); if (okclicked) { mainapp.getpersondata().add(tempperson); } } /** * called when user clicks edit button. opens dialog edit * details selected person. */ @fxml private void handleeditperson() { person selectedperson = persontable.getselectionmodel().getselecteditem(); if (selectedperson != null) { boolean okclicked = mainapp.showpersoneditdialog(selectedperson); if (okclicked) { showpersondetails(selectedperson); } } else { // nothing selected. dialogs.create() .title("no selection") .masthead("no word selected") .message("please select word in table.") .showwarning(); } } /** * called when user clicks show answer button. opens dialog edit * details selected person. */ @fxml private void handleanswer() { person selectedperson = persontable.getselectionmodel().getselecteditem(); if (selectedperson != null) { boolean okclicked = mainapp.showanswerdialog(selectedperson); if (okclicked) { showpersondetails(selectedperson); } } else { // nothing selected. dialogs.create() .title("no selection") .masthead("no word selected") .message("please select word in table.") .showwarning(); } } /** * called when user clicks on train english button. */ @fxml private void handletrainenglish() { person selectedperson = persontable.getselectionmodel().getselecteditem(); if (selectedperson != null) { boolean okclicked = mainapp.showenglishtraindialog(selectedperson); if (okclicked) { showpersondetails(selectedperson); } } else { // nothing selected. dialogs.create() .title("no selection") .masthead("no word selected") .message("please select word in table.") .showwarning(); } } }
it seems in contrast e.g. spring, fxml not change access-level of methods calls reflection. means need make initialize()
-method public can called javafx.fxml.fxmlloader
.
Comments
Post a Comment