show a popup window when an event is occured javafx


Question

I want to open a popup dialog when a 'signup' button is clicked. I want to add elements like textfield, password field on the pop up dialog. It would be better if you can suggest me how to add components to a popup window and then add the pop window to a pane and show it. Thank you!.

1
3
1/7/2014 10:21:22 AM

Accepted Answer

You can make one :

Popup pop = PopupBuilder.create().content(contentNode).width(50).height(100).autoFix(true).build();
pop.show(stage);
1
9/23/2014 12:50:14 PM

Just make a new Stage, then add desired components to it. For example:

public static void showStage(){
Stage newStage = new Stage();
VBox comp = new VBox();
TextField nameField = new TextField("Name");
TextField phoneNumber = new TextField("Phone Number");
comp.getChildren().add(nameField);
comp.getChildren().add(phoneNumber);

Scene stageScene = new Scene(comp, 300, 300);
newStage.setScene(stageScene);
newStage.show();
}

Call the method from the main and see that a new stage pops up.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon