Reputation: 315
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!.
Upvotes: 3
Views: 21268
Reputation: 530
You can make one :
Popup pop = PopupBuilder.create().content(contentNode).width(50).height(100).autoFix(true).build();
pop.show(stage);
Upvotes: 2
Reputation: 504
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.
Upvotes: 6