passwordNew.disableProperty().bind(passwordKey.textProperty().isEmpty().or(validKey.not())); passwordNew.textProperty().addListener((observable, oldValue, newValue) -> { if (!Strings.isNullOrEmpty(passwordKey.getText())){
@Override // This method is called by the FXMLLoader when initialization is complete public void initialize(URL fxmlFileLocation, ResourceBundle resources) { assert password != null : "fx:id=\"password\" was not injected: check your FXML file 'Login.fxml'."; assert serverAddress != null : "fx:id=\"serverAddress\" was not injected: check your FXML file 'Login.fxml'."; assert serverRadioButton != null : "fx:id=\"serverRadioButton\" was not injected: check your FXML file 'Login.fxml'."; assert startButton != null : "fx:id=\"startButton\" was not injected: check your FXML file 'Login.fxml'."; assert user != null : "fx:id=\"user\" was not injected: check your FXML file 'Login.fxml'."; ToggleGroup groupConnection = new ToggleGroup(); serverRadioButton.setSelected(true); serverRadioButton.setToggleGroup(groupConnection); user.disableProperty().bind(serverRadioButton.selectedProperty().not()); password.disableProperty().bind(serverRadioButton.selectedProperty().not()); serverAddress.disableProperty().bind(serverRadioButton.selectedProperty().not()); startButton.disableProperty().bind(serverAddress.textProperty().isEqualTo("")); startButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { if (serverRadioButton.isSelected()) { cleanup(); mainFactory.setHttpGuiCopperDataProvider(serverAddress.getText(), user.getText(), password.getText()); } } catch (Exception e) { throw new RuntimeException(e); } } }); serverAddress.textProperty().bindBidirectional(settingsModelSingleton.lastConnectedServer); }