mirror of
https://gitlab.com/kauron/jstudy
synced 2024-12-23 00:43:32 +01:00
Main: better new table dialog
This commit is contained in:
parent
1d19cf31d3
commit
9d9db75919
1 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue