diff --git a/main/ui/src/main/java/org/cryptomator/ui/MainController.java b/main/ui/src/main/java/org/cryptomator/ui/MainController.java index a2871f183..02afd3c19 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/MainController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/MainController.java @@ -154,10 +154,8 @@ public class MainController implements Initializable { private void showUsernameField() { messageLabel.setText(rb.getString("main.messageLabel.initVaultMessage")); - if (rootPane.getChildren().contains(usernameBox)) { - rootPane.getChildren().remove(usernameBox); - rootPane.getChildren().add(usernameField); - } + usernameBox.setVisible(false); + usernameField.setVisible(true); Platform.runLater(usernameField::requestFocus); } @@ -184,10 +182,8 @@ public class MainController implements Initializable { private void showUsernameBox(Iterator foundMasterKeys) { messageLabel.setText(rb.getString("main.messageLabel.openVaultMessage")); - if (rootPane.getChildren().contains(usernameField)) { - rootPane.getChildren().remove(usernameField); - rootPane.getChildren().add(usernameBox); - } + usernameField.setVisible(false); + usernameBox.setVisible(true); // update usernameBox options: usernameBox.getItems().clear(); @@ -245,10 +241,8 @@ public class MainController implements Initializable { // **************************************** private void showInitializeButton() { - if (rootPane.getChildren().contains(openButton)) { - rootPane.getChildren().remove(openButton); - rootPane.getChildren().add(initializeButton); - } + openButton.setVisible(false); + initializeButton.setVisible(true); } @FXML @@ -293,10 +287,8 @@ public class MainController implements Initializable { // **************************************** private void showOpenButton() { - if (rootPane.getChildren().contains(initializeButton)) { - rootPane.getChildren().remove(initializeButton); - rootPane.getChildren().add(openButton); - } + initializeButton.setVisible(false); + openButton.setVisible(true); } @FXML diff --git a/main/ui/src/main/resources/main.fxml b/main/ui/src/main/resources/main.fxml index 623a1379c..1db791b26 100644 --- a/main/ui/src/main/resources/main.fxml +++ b/main/ui/src/main/resources/main.fxml @@ -1,12 +1,5 @@ - + @@ -27,20 +20,6 @@ - - - - - - - - - - - - - - @@ -59,6 +38,8 @@