From 9d9db75919773c946c40015ff6b1f246e67172ff Mon Sep 17 00:00:00 2001 From: Carlos Galindo Date: Mon, 13 Jun 2016 15:13:14 +0200 Subject: [PATCH] Main: better new table dialog --- src/main/java/es/kauron/jstudy/controller/Controller.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/es/kauron/jstudy/controller/Controller.java b/src/main/java/es/kauron/jstudy/controller/Controller.java index c4293f0..d48c325 100644 --- a/src/main/java/es/kauron/jstudy/controller/Controller.java +++ b/src/main/java/es/kauron/jstudy/controller/Controller.java @@ -55,8 +55,14 @@ public class Controller implements Initializable { @FXML private void onNewAction(ActionEvent event) { - TextInputDialog dialog = new TextInputDialog("Name"); + TextInputDialog dialog = new TextInputDialog(); + dialog.getEditor().setPromptText("Table name"); + dialog.setTitle("Creating new table"); + dialog.setHeaderText("Please input a name for the new table"); + dialog.getDialogPane().setMinWidth(250); dialog.showAndWait(); + dialog.setResultConverter(value -> value.getButtonData().equals(ButtonBar.ButtonData.OK_DONE) ? value.getText() : ""); + if (dialog.getResult() == null || dialog.getResult().isEmpty()) return; tabPane.getTabs().add(createTableTab(dialog.getResult(), new ArrayList<>())); tabPane.getSelectionModel().selectLast(); }