Search in sources :

Example 6 with ColumnConstraints

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);
}
Also used : HBox(javafx.scene.layout.HBox) BusyAnimation(io.bitsquare.gui.components.BusyAnimation) Wallet(org.bitcoinj.core.Wallet) ColumnConstraints(javafx.scene.layout.ColumnConstraints) Popup(io.bitsquare.gui.main.overlays.popups.Popup) KeyCrypterScrypt(org.bitcoinj.crypto.KeyCrypterScrypt)

Example 7 with ColumnConstraints

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;
}
Also used : GridPane(javafx.scene.layout.GridPane) ColumnConstraints(javafx.scene.layout.ColumnConstraints) RowConstraints(javafx.scene.layout.RowConstraints)

Aggregations

ColumnConstraints (javafx.scene.layout.ColumnConstraints)7 RowConstraints (javafx.scene.layout.RowConstraints)5 Label (javafx.scene.control.Label)3 GridPane (javafx.scene.layout.GridPane)3 BorderPane (javafx.scene.layout.BorderPane)2 VacuumEnvironment (aima.core.environment.vacuum.VacuumEnvironment)1 XYLocation (aima.core.util.datastructure.XYLocation)1 BusyAnimation (io.bitsquare.gui.components.BusyAnimation)1 Popup (io.bitsquare.gui.main.overlays.popups.Popup)1 ArrayList (java.util.ArrayList)1 Insets (javafx.geometry.Insets)1 Button (javafx.scene.control.Button)1 Separator (javafx.scene.control.Separator)1 ToolBar (javafx.scene.control.ToolBar)1 Background (javafx.scene.layout.Background)1 BackgroundFill (javafx.scene.layout.BackgroundFill)1 HBox (javafx.scene.layout.HBox)1 StackPane (javafx.scene.layout.StackPane)1 Circle (javafx.scene.shape.Circle)1 Polygon (javafx.scene.shape.Polygon)1