I have a javafx application with a popup window, which contains some checkboxes. I want to set the selected value from true to false, but I can't find a way to do this from inside the controller.
Redefining values works well for the main window from inside the INITIALIZE class, both for checkboxes and buttons, but the redefined values have no effect on the nodes in the popup window.
The solutions is probably simple, still I am having a more than hard time to figure it out.
Any ideas?
@FXML
private CheckBox googleHider;
@FXML
public Button googleButton;
@FXML
private CheckBox popupCheckbox;
@FXML
public void openDialog(ActionEvent event) throws IOException{
Stage stage;
Parent root;
if(event.getSource()==dialog){
//following line should set the value for the checkbox, but popup refuses to open
popupCheckbox.setSelected(false);
stage = new Stage();
root = FXMLLoader.load(getClass().getResource("PopupFXML.fxml"));
stage.setScene(new Scene(root));
stage.setTitle("Dialog Window");
stage.initModality(Modality.APPLICATION_MODAL);
stage.initOwner(dialog.getScene().getWindow());
stage.showAndWait();
}
@Override
public void initialize(URL url, ResourceBundle rb) {
// works fine, button is in the main window
googleButton.setText("hello");
// works fine, checkbox is in the main window
checkbox.setSelected(false);
//doesn't work, checkbox is in the popup window
popupCheckbox.setSelected(false);
} catch (Exception e) {
}