java - JavaFX-SceneBuilder - Can't access fx:id when opening new window -
i have code (part of quite big application): following function located in controller class of project.
public void callsearch(){ stage supplystage = new stage(); parent root = null; try { root = fxmlloader.load(getclass().getresource("supplyresult.fxml")); supplystage.settitle("supply result set"); supplystage.setscene(new scene(root, 1400, 900)); supplystage.show(); } catch (ioexception e) { e.printstacktrace(); } try { typecolumn.setcellvaluefactory(new propertyvaluefactory<supply, string>("type")); namecolumn.setcellvaluefactory(new propertyvaluefactory<supply, string>("name")); datecolumn.setcellvaluefactory(new propertyvaluefactory<supply, string>("order_date")); priceperunitcolumn.setcellvaluefactory(new propertyvaluefactory<>("priceperunit")); quantitycolumn.setcellvaluefactory(new propertyvaluefactory<>("quantity")); } catch (nullpointerexception npe){ system.out.println("null..."); } searchsupplystartdate = java.sql.date.valueof(startdatedatepicker.getvalue()); searchsupplyenddate = java.sql.date.valueof(enddatedatepicker.getvalue()); tableoutput.setitems(mymain.getsupplies(searchsupplystartdate,searchsupplyenddate,null,null)); }
my problem nullpointerexception
in line typecolumn.setcellvaluefactory(new propertyvaluefactory<supply, string>("type"));
in previous version of application had columns in same window rest of scene. try add second window when displaying same stuff, make first scene bit more beautiful. (the code working when had 1 scene).
in fact, make things clear, want press of button, function callsearch() called. window appears, table of 5 columns attached: typecolumn, namecolumn, datecolumn, priceperunitcolumn, quantitycolumn. 5 columns declared in (only) controller of project, thought visible in fxml file in project, that's not case.
does know missing? typecolumn
visible supplyresult.fxml
in scene builder, not seem execute code has to...
Comments
Post a Comment