when i want to setText for TextField (miniFilePath) it throws null exception i don't know what is wrong with my code?
public class SettingsController {
@FXML
private TextField miniFilePath;
@FXML
private Button settingExitBtn;
public static String miniFilterPath = new String() ;
public static String reportDirectoryPath = new String();
Stage settings = new Stage();
public void display( ){
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Settings.fxml"));
Parent root = (Parent) fxmlLoader.load();
//settings = new Stage();
Stage settings = new Stage();
settings.setScene(new Scene(root));
settings.initModality(Modality.APPLICATION_MODAL);
settings.setResizable(false);
settings.setTitle("settings");
if (!miniFilterPath.isEmpty())
miniFilePath.setText(miniFilterPath);
settings.show();
} catch(Exception e) {
e.printStackTrace();
}
}
this class works as my second window, when i click on one button in another window one instance of this class is called and the window is made. i want that after user set text for a textfield every time user try to open this window the text field is set to the string that is set before.