use of javafx.scene.layout.ColumnConstraints in project bitsquare by bitsquare.
the class WalletPasswordWindow method addButtons.
private void addButtons() {
BusyAnimation busyAnimation = new BusyAnimation(false);
Label deriveStatusLabel = new Label();
unlockButton = new Button("Unlock");
unlockButton.setDefaultButton(true);
unlockButton.setDisable(true);
unlockButton.setOnAction(e -> {
String password = passwordTextField.getText();
checkArgument(password.length() < 50, "Password must be less then 50 characters.");
Wallet wallet = walletService.getWallet();
KeyCrypterScrypt keyCrypterScrypt = (KeyCrypterScrypt) wallet.getKeyCrypter();
if (keyCrypterScrypt != null) {
busyAnimation.play();
deriveStatusLabel.setText("Derive key from password");
ScryptUtil.deriveKeyWithScrypt(keyCrypterScrypt, password, aesKey -> {
if (wallet.checkAESKey(aesKey)) {
if (aesKeyHandler != null)
aesKeyHandler.onAesKey(aesKey);
hide();
} else {
busyAnimation.stop();
deriveStatusLabel.setText("");
UserThread.runAfter(() -> new Popup().warning("You entered the wrong password.\n\n" + "Please try entering your password again, carefully checking for typos or spelling errors.").onClose(this::blurAgain).show(), Transitions.DEFAULT_DURATION, TimeUnit.MILLISECONDS);
}
});
} else {
log.error("wallet.getKeyCrypter() is null, that must not happen.");
}
});
forgotPasswordButton = new Button("Forgot password?");
forgotPasswordButton.setOnAction(e -> {
forgotPasswordButton.setDisable(true);
unlockButton.setDefaultButton(false);
showRestoreScreen();
});
Button cancelButton = new Button("Cancel");
cancelButton.setOnAction(event -> {
hide();
closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
});
HBox hBox = new HBox();
hBox.setMinWidth(560);
hBox.setSpacing(10);
GridPane.setRowIndex(hBox, ++rowIndex);
GridPane.setColumnIndex(hBox, 1);
hBox.setAlignment(Pos.CENTER_LEFT);
if (hideCloseButton)
hBox.getChildren().addAll(unlockButton, forgotPasswordButton, busyAnimation, deriveStatusLabel);
else
hBox.getChildren().addAll(unlockButton, cancelButton);
gridPane.getChildren().add(hBox);
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHalignment(HPos.RIGHT);
columnConstraints1.setHgrow(Priority.SOMETIMES);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
}
use of javafx.scene.layout.ColumnConstraints in project jgnash by ccavanaugh.
the class SelectAccountSecuritiesDialog method createGridPane.
private GridPane createGridPane() {
final GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("form");
final ColumnConstraints col0 = new ColumnConstraints();
col0.setFillWidth(true);
col0.setHgrow(Priority.ALWAYS);
col0.setMaxWidth(Double.MAX_VALUE);
col0.setPrefWidth(220);
final ColumnConstraints col1 = new ColumnConstraints();
col1.setFillWidth(true);
col1.setHgrow(Priority.NEVER);
final ColumnConstraints col2 = new ColumnConstraints();
col2.setFillWidth(true);
col2.setHgrow(Priority.ALWAYS);
col2.setMaxWidth(Double.MAX_VALUE);
col2.setPrefWidth(220);
gridPane.getColumnConstraints().addAll(col0, col1, col2);
final RowConstraints row0 = new RowConstraints();
row0.setFillHeight(true);
row0.setVgrow(Priority.NEVER);
final RowConstraints row1 = new RowConstraints();
row1.setMaxHeight(Double.MAX_VALUE);
row1.setPrefHeight(220);
row1.setVgrow(Priority.ALWAYS);
final RowConstraints row2 = new RowConstraints();
row0.setFillHeight(true);
row0.setVgrow(Priority.NEVER);
gridPane.getRowConstraints().addAll(row0, row1, row2);
return gridPane;
}
Aggregations