javafx - child fxml file not loading to parent fxml -


hello guys m new fxml please ignore silly question here few things m try 2 day got not success

  1. remove white space table i.e table size should number of available row(number of row varies)
  2. when user click on table row(any display value) new fxml file open in anchor pane(tableview displayed) allotted tableview want display in main view (where whole thing table , 2 text field , search button behind main stack want display here) main view (other fxml file has have header , sidebar)

    as show in below link of image table image of required things

here code

   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 {                   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();                     stackmain.getchildren().clear();                     stackview.getchildren().add(root);                    } catch (ioexception e) {                 e.printstacktrace();              }           }         }); 

hi first point here solution: can set cellsize in tableview, able use row getting heights(i found simplest way rows' height). after have bind table's prefheight size of data this:

tableview.setfixedcellsize(20); tableview.prefheightproperty().bind(bindings.size(data).multiply(tableview.getfixedcellsize()).add(30)); 

there .add(30) because have add tableheaderrow's size, , simplest way, little experimentation , set value explicitly. if want exact value, can via .lookups tableheaderrow height.

i don't understand second problem want display it. can use fxmlloader load view , add it, if specify little bit better want add(in .fxml, , how linked .fxml contains table).


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 -