javafx - nested child call to super parent -


i m new javafx please ignore silly question here problem m facing 2 day great if body me have super parent (main view) in country fxml view loader , in country fxml have 1 more fxml(call table) loaded country when user click on data of table view new fxml file loaded , file want load parent had used super parent stack pane id throw error please me why happening solution link ,code or suggestion save day here code

observablelist<addcountrycontroller> data = fxcollections.observablearraylist(); private pagination pagination; @fxml private anchorpane cresult; @fxml private stackpane stackconsearch; @fxml private stackpane stackhome; @fxml private anchorpane stackanc; @fxml private stackpane stackcountry; @fxml private tableview<addcountrycontroller> tableuser; @fxml private tablecolumn<addcountrycontroller, string> columnname; @fxml private tablecolumn<addcountrycontroller, string> columndesc; databasehandler databasehandler;  public void settext(string first,string sec){     this.country.settext(first);     this.desc.settext(sec); }   @override public void initialize(url location, resourcebundle resources) {     databasehandler = databasehandler.getinstance();     initcol();          string qu = "select * country_tbl ";         resultset rs = databasehandler.execquery(qu);             try {                 while (rs.next()) {                  string id= rs.getstring("id");                  string name= rs.getstring("countryname");                  string description = rs.getstring("descr");                  string country2char= rs.getstring("country2char");                  string descrshort = rs.getstring("descrshort");                  data.add(new addcountrycontroller(id,name, description,country2char,descrshort));                 }             }catch (sqlexception ex) {                 logger.getlogger(addcountrycontroller.class.getname()).log(level.severe, null, ex);             }           tableuser.setitems(null);          tableuser.setitems(data);           tableuser.getselectionmodel().setselectionmode(selectionmode.multiple);          tableuser.getselectionmodel().getselecteditems().addlistener(new listchangelistener<addcountrycontroller>() {          public void onchanged(listchangelistener.change<? extends addcountrycontroller> c) {              try {                   stage primarystage=new stage();                  fxmlloader loader =new fxmlloader();                  loader.load(getclass().getresource("/region/updatecountry.fxml").openstream());                  updatecountrycontroller usercontroller=(updatecountrycontroller)loader.getcontroller();                     (addcountrycontroller p : c.getlist()) {                      string addid=p.getid();                      string add=p.getname();                          string add1=p.getdescriptionshort();                      string add2=p.getdescription();                      string add3=p.getcountrychar();                      usercontroller.settext(addid,add,add1,add2,add3);                    }                     stackpane root = loader.getroot();                                           stackconsearch.getchildren().clear();                     stackconsearch.getchildren().add(root);                } catch (ioexception e) {                 e.printstacktrace();              }           }         }); } 

here editcontroller

         private stackpane stackhome; @fxml private stackpane stackconsearch; @fxml private anchorpane cresult; @fxml private textfield country; @fxml private textfield desc;  public void add(actionevent event) {     string add=countrycode.gettext();     try {         if(add.isempty()){                 alert alert=new alert(alert.alerttype.error);                 alert.setheadertext(null);                 alert.setcontenttext("please fill data");                 alert.showandwait();                 return;         }         fxmlloader loader =new fxmlloader();         loader.load(getclass().getresource("/region/newcountry.fxml").openstream());          maincontroller usercontroller=(maincontroller)loader.getcontroller();         usercontroller.settext(add);         stackpane root = loader.getroot();         stackconsearch.getchildren().clear();         stackconsearch.getchildren().add(root);          }catch(exception e) {             e.printstacktrace();     }  }  public void search(actionevent event) {     string countrytxt=country.gettext();     string desctxt=desc.gettext();     if(countrytxt.isempty() && desctxt.isempty())   {         try{             fxmlloader fxmlloader = new fxmlloader();             fxmlloader.load(getclass().getresource("/region/cresult.fxml").openstream());              stackpane root = fxmlloader.getroot();             root.getstylesheets().add(getclass().getresource("/application/application.css").toexternalform());              countrycontroller usercontroller=(countrycontroller)fxmlloader.getcontroller();             usercontroller.settext(countrytxt,desctxt);             cresult.getchildren().clear();             cresult.getchildren().add(root);                 }catch(ioexception e){             e.printstacktrace();         }     }else{         try{             fxmlloader fxmlloader = new fxmlloader();             fxmlloader.load(getclass().getresource("/region/cresult.fxml").openstream());             stackpane root = fxmlloader.getroot();             countrycontroller usercontroller=(countrycontroller)fxmlloader.getcontroller();             usercontroller.settext(countrytxt,desctxt);             cresult.getchildren().clear();             cresult.getchildren().add(root);                 }catch(ioexception e){             e.printstacktrace();         }     } } 

here main controller

  @fxml private stackpane stackhome; @fxml private anchorpane mainview; @fxml private anchorpane stackanc; @override public void start(stage primarystage) {     try {         parent root =fxmlloader.load(getclass().getresource("main.fxml"));         scene scene = new scene(root);         scene.getstylesheets().add(getclass().getresource("application.css").toexternalform());         primarystage.setscene(scene);         primarystage.show();     } catch(exception e) {         e.printstacktrace();     } }  @fxml public void country(actionevent event) {       fxmlloader fxmlloader = new fxmlloader();         try {             fxmlloader.load(getclass().getresource("/region/country.fxml").openstream());         } catch (ioexception e) {          }         stackpane root = fxmlloader.getroot();         stackhome.getchildren().clear();         stackhome.getchildren().add(root); }  public static void main(string[] args) {     launch(args); } 

here stackhome super parent , stackcountry parent , child of super parent , have 1 more parent stacksub child of stackhome,stackcountry , has child called stackchild want load stackchild stackhome not working suggestion


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -