I want to make a simply program consisting of two windows. The first window has a check box. If you select it: the second window is shown. If you deselect it: the second window is hidden. I tested this out with print line statements and it worked. But when I implemented the code for the second stage: the hide function isn't working. Anyone know why?
public void show() throws IOException{
Stage secondaryStage = new Stage();
FXMLLoader loader = new
FXMLLoader(Main.class.getResource("second.fxml"));
AnchorPane root = loader.load();
Scene scene = new Scene (root);
secondaryStage.setScene(scene);
if(check.isSelected()){secondaryStage.show();
}
else {secondaryStage.hide();}
}
Aucun commentaire:
Enregistrer un commentaire