import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.PasswordFieldBuilder; import javafx.scene.control.TextField; import javafx.scene.control.TextFieldBuilder; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.stage.Stage; import javafx.application.Application; public class AccountDialog extends Application{ private TextField txtAccName,txtUserName,txtInServer,txtOutServer,txtInPort,txtOutPort,txtEmail; private PasswordField txtPass; private ComboBox cmbInAccType,cmbInSec,cmbOutSec; public void start(final Stage stage) throws Exception { //initModality(Modality.APPLICATION_MODAL); stage.setTitle("New Account"); Group parent = new Group(); Scene scene = new Scene(parent, 640, 480); GridPane grid = new GridPane(); grid.setPadding(new Insets(20)); grid.setHgap(10); grid.setVgap(10); grid.add(new Label("Account Name"), 0, 0); grid.add((txtAccName = TextFieldBuilder.create().promptText("Account Name").build()), 1, 0,4,1); grid.add(new Label("Email"), 0, 1); grid.add((txtEmail = TextFieldBuilder.create().promptText("Email ID").build()), 1, 1,4,1); grid.add(new Label("User Name"), 0, 2); grid.add((txtUserName = TextFieldBuilder.create().promptText("User Name").build()), 1, 2,4,1); grid.add(new Label("Password"), 0, 3); grid.add((txtPass = PasswordFieldBuilder.create().promptText("Password").build()), 1, 3,4,1); grid.add(new Label("Incoming Server"), 0, 4); grid.add((txtInServer = TextFieldBuilder.create().promptText("Incoming Server").build()), 1, 4); grid.add((cmbInAccType = new ComboBox<>()), 2, 4); grid.add((cmbInSec = new ComboBox<>()), 3, 4); grid.add((txtInPort = TextFieldBuilder.create().promptText("Port").build()), 4, 4); txtInPort.setPrefWidth(40); grid.add(new Label("Outgoing Server"), 0, 5); grid.add((txtOutServer = TextFieldBuilder.create().promptText("Outgoing Server").build()), 1, 5,2,1); //grid.add((cmbInAccType = ComboBoxBuilder.create().build()), 2, 4); grid.add((cmbOutSec = new ComboBox<>()), 3, 5); grid.add((txtOutPort = TextFieldBuilder.create().promptText("Port").build()), 4, 5); HBox buttonBox = new HBox(); buttonBox.setPadding(new Insets(10, 10, 10, 250)); buttonBox.setSpacing(20); buttonBox.layoutYProperty().bind(grid.heightProperty()); Button btnAdd = new Button("Add"); Button btnCancel = new Button("Cancel"); buttonBox.getChildren().addAll(btnAdd,btnCancel); parent.getChildren().addAll(grid,buttonBox); cmbInAccType.getItems().addAll("POP3","IMAP"); cmbInAccType.setValue("POP3"); cmbInSec.getItems().addAll("Normal","SSL","TLS","SSL/TLS"); cmbInSec.setValue("Normal"); cmbOutSec.getItems().addAll("Normal","SSL","TLS","SSL/TLS"); cmbOutSec.setValue("Normal"); stage.setScene(scene); stage.show(); stage.setMinHeight(scene.heightProperty().doubleValue()); stage.setMaxHeight(scene.heightProperty().doubleValue()); stage.setMinWidth(scene.widthProperty().doubleValue()); stage.setMaxWidth(scene.widthProperty().doubleValue()); } public static void main(String[]args){ launch(args); } }