1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-11-13 07:33:44 +01:00

Main: better new table dialog

This commit is contained in:
Carlos Galindo 2016-06-13 15:13:14 +02:00
parent 1d19cf31d3
commit 9d9db75919
Signed by: kauron
GPG key ID: 83E68706DEE119A3

View file

@ -55,8 +55,14 @@ public class Controller implements Initializable {
@FXML @FXML
private void onNewAction(ActionEvent event) { 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.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.getTabs().add(createTableTab(dialog.getResult(), new ArrayList<>()));
tabPane.getSelectionModel().selectLast(); tabPane.getSelectionModel().selectLast();
} }