From hours later I tried to find errors, I don't know what is causing this problem, I'm using a controller class and a FXML, the problem is that in the initialization function tableview is null, don't know why, here's the controller:
Package controller. The popup;
The import controller. Controllerable;
The import elements. EditableTableCell;
The import java.net.URL;
Import the Java. Util. ResourceBundle;
The import deployment headaches. Event. An ActionEvent.
The import deployment headaches. Event. EventHandler;
The import deployment headaches. FXML. FXML;
The import deployment headaches. FXML. Initializable;
The import deployment headaches. Scene. Control. TableCell;
The import deployment headaches. Scene. Control. The TableColumn;
The import deployment headaches. Scene. Control. TableView;
The import deployment headaches. Scene. Control. TextField;
The import deployment headaches. Scene. Control. The cell. PropertyValueFactory;
The import deployment headaches. Stage. WindowEvent;
The import deployment headaches. Util. Callback;
The import model. CDUSettings;
The import model. Modelable;
The import model. Data. AnnouncementData;
The import model. Data. PopupData;
The import model. The popup. AnnouncmentsPopupModel;
Public class AnnouncementsPopupController implements Controllerable, Initializable
{
//& lt; Editor - a fold desc="FXML import stuff" defaultstate="collapsed" & gt;
@ FXML
Private TableView
@ FXML//fx: id="guiAnnouncementAddColor
"Private TextField guiAnnouncementAddColor;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddDisplayedText
"Private TextField guiAnnouncementAddDisplayedText;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddDuration
"Private TextField guiAnnouncementAddDuration;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddFontEffect
"Private TextField guiAnnouncementAddFontEffect;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddFontSize
"Private TextField guiAnnouncementAddFontSize;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddId
"Private TextField guiAnnouncementAddId;//Value injected by FXMLLoader
@ FXML//fx: id="guiAnnouncementAddType
"Private TextField guiAnnouncementAddType;//Value injected by FXMLLoader
@ FXML//fx: id="guiColorColumn
"Private TableColumn
@ FXML//fx: id="guiDisplayedTextColumn
"Private TableColumn
@ FXML//fx: id="guiDurationColumn
"Private TableColumn
@ FXML//fx: id="guiFontEffectColumn
"Private TableColumn
@ FXML//fx: id="guiFontSizeColumn
"Private TableColumn
@ FXML//fx: id="guiIdColumn
"Private TableColumn
@ FXML//fx: id="guiTypeColumn
"Private TableColumn
//& lt;/editor - fold>
Private Modelable model=null;
Public AnnouncementsPopupController () {
ConnectToModel ();
}
@ Override
Public Modelable getModel () {
Return the model;
}
@ Override
Public void onCloseEvent (WindowEvent we)
{
CDUSettings. GetInstance (). ClearAnnouncements ();
For (PopupData announce: model. GetData ()) {
CDUSettings. GetInstance (). AddAnnouncement ((AnnouncementData) announce);
}
}
@ Override
Public void the initialize (URL URL, ResourceBundle rb)
{
ConnectToModel ();
Callback
New Callback
{
@ Override
Public TableCell call (the TableColumn p) {
Return new EditableTableCell ();
}
};
GuiAnnouncementIdColumn. SetCellValueFactory (new PropertyValueFactory
GuiAnnouncementIdColumn. SetCellFactory (editableFactory);
GuiAnnouncementIdColumn. SetOnEditCommit (new EventHandler
{
@ Override
Public void handle (the TableColumn. CellEditEvent
(t.g etTableView (.) getItems () get (t.g etTablePosition () getRow ())). The setId (t.g etNewValue ());
}
});
GuiAnnouncementColorColumn. SetCellValueFactory (new PropertyValueFactory
GuiAnnouncementColorColumn. SetCellFactory (editableFactory);
GuiAnnouncementColorColumn. SetOnEditCommit (new EventHandler