0

I've view that contains a table and a button. The button opens a dialog (another view) with a few text fields and a button.

How can I add the data entered in the dialog's text fields to the table in the first window (the window that called the dialog).

main.fxml.MainController
dialog.fxml.DialogController

I've tried to set the table (TableView) in the main window to public static, but I still get the java.lang.NullPointerException. I can add data to the table, but only from the same window where the table is.

Br,

Klaus

Darek Kay
  • 15,827
  • 7
  • 64
  • 61
  • You should look for solutions that share the data between controllers, not the view (e.g. the table). Then your question simply becomes "How do I pass data to another controller", which is addressed here: http://stackoverflow.com/questions/14187963/passing-parameters-javafx-fxml/14190310#14190310 – James_D Sep 30 '14 at 14:36
  • Thanx James, so if I understod you correctly I should use a model for this. I've created a model "Person", so no my question is how should I add data to the model in the dialog and use it to add data to the TableView. – Klaus Friman Oct 02 '14 at 13:55
  • The model for the table is basically the items list. – James_D Oct 02 '14 at 14:30

0 Answers0