Search in sources :

Example 11 with HBox

use of javafx.scene.layout.HBox in project bitsquare by bitsquare.

the class EmptyWalletWindow method addContent.

private void addContent() {
    addMultilineLabel(gridPane, ++rowIndex, "Please use that only in emergency case if you cannot access your fund from the UI.\n\n" + "Please note that all open offers will be closed automatically when using this tool.\n\n" + "Before you use this tool, please backup your data directory. " + "You can do this under \"Account/Backup\".\n\n" + "Please file a bug report on Github so that we can investigate what was causing the problem.", 10);
    Coin totalBalance = walletService.getAvailableBalance();
    balanceTextField = addLabelTextField(gridPane, ++rowIndex, "Your available wallet balance:", formatter.formatCoinWithCode(totalBalance), 10).second;
    Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++rowIndex, "Your destination address:");
    addressInputTextField = tuple.second;
    if (DevFlags.DEV_MODE)
        addressInputTextField.setText("mjYhQYSbET2bXJDyCdNqYhqSye5QX2WHPz");
    emptyWalletButton = new Button("Empty wallet");
    boolean isBalanceSufficient = Restrictions.isAboveDust(totalBalance);
    emptyWalletButton.setDefaultButton(isBalanceSufficient);
    emptyWalletButton.setDisable(!isBalanceSufficient && addressInputTextField.getText().length() > 0);
    emptyWalletButton.setOnAction(e -> {
        if (addressInputTextField.getText().length() > 0 && isBalanceSufficient) {
            if (walletService.getWallet().isEncrypted()) {
                walletPasswordWindow.onAesKey(this::doEmptyWallet).onClose(this::blurAgain).show();
            } else {
                doEmptyWallet(null);
            }
        }
    });
    closeButton = new Button("Cancel");
    closeButton.setOnAction(e -> {
        hide();
        closeHandlerOptional.ifPresent(Runnable::run);
    });
    closeButton.setDefaultButton(!isBalanceSufficient);
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(emptyWalletButton, closeButton);
    gridPane.getChildren().add(hBox);
    GridPane.setMargin(hBox, new Insets(10, 0, 0, 0));
}
Also used : Coin(org.bitcoinj.core.Coin) HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) Button(javafx.scene.control.Button) InputTextField(io.bitsquare.gui.components.InputTextField) Label(javafx.scene.control.Label)

Example 12 with HBox

use of javafx.scene.layout.HBox in project bitsquare by bitsquare.

the class EnterPrivKeyWindow method addButtons.

private void addButtons() {
    unlockButton = new Button("Unlock");
    unlockButton.setDefaultButton(true);
    unlockButton.setDisable(keyInputTextField.getText().length() == 0);
    unlockButton.setOnAction(e -> {
        if (privKeyHandler.checkKey(keyInputTextField.getText()))
            hide();
        else
            new Popup().warning("The key you entered was not correct.").width(300).onClose(() -> blurAgain()).show();
    });
    Button cancelButton = new Button("Close");
    cancelButton.setOnAction(event -> {
        hide();
        closeHandlerOptional.ifPresent(closeHandler -> closeHandler.run());
    });
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    GridPane.setRowIndex(hBox, ++rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    hBox.getChildren().addAll(unlockButton, cancelButton);
    gridPane.getChildren().add(hBox);
}
Also used : HBox(javafx.scene.layout.HBox) Button(javafx.scene.control.Button) Popup(io.bitsquare.gui.main.overlays.popups.Popup)

Example 13 with HBox

use of javafx.scene.layout.HBox in project bitsquare by bitsquare.

the class OfferBookChartView method initialize.

@Override
public void initialize() {
    changeListener = c -> updateChartData();
    currencyListItemsListener = c -> {
        if (model.getSelectedCurrencyListItem().isPresent())
            currencyComboBox.getSelectionModel().select(model.getSelectedCurrencyListItem().get());
    };
    currencyComboBox = new ComboBox<>();
    currencyComboBox.setPromptText("Select currency");
    currencyComboBox.setConverter(GUIUtil.getCurrencyListItemConverter("offers", model.preferences));
    Label currencyLabel = new Label("Currency:");
    HBox currencyHBox = new HBox();
    currencyHBox.setSpacing(5);
    currencyHBox.setPadding(new Insets(5, -20, -5, 20));
    currencyHBox.setAlignment(Pos.CENTER_LEFT);
    currencyHBox.getChildren().addAll(currencyLabel, currencyComboBox);
    createChart();
    Tuple4<TableView<OfferListItem>, VBox, Button, Label> tupleBuy = getOfferTable(Offer.Direction.BUY);
    Tuple4<TableView<OfferListItem>, VBox, Button, Label> tupleSell = getOfferTable(Offer.Direction.SELL);
    buyOfferTableView = tupleBuy.first;
    sellOfferTableView = tupleSell.first;
    buyOfferButton = tupleBuy.third;
    sellOfferButton = tupleSell.third;
    buyOfferHeaderLabel = tupleBuy.forth;
    sellOfferHeaderLabel = tupleSell.forth;
    bottomHBox = new HBox();
    //30
    bottomHBox.setSpacing(20);
    bottomHBox.setAlignment(Pos.CENTER);
    HBox.setHgrow(tupleBuy.second, Priority.ALWAYS);
    HBox.setHgrow(tupleSell.second, Priority.ALWAYS);
    tupleBuy.second.setUserData("BUY");
    tupleSell.second.setUserData("SELL");
    bottomHBox.getChildren().addAll(tupleBuy.second, tupleSell.second);
    root.getChildren().addAll(currencyHBox, areaChart, bottomHBox);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) VBox(javafx.scene.layout.VBox)

Example 14 with HBox

use of javafx.scene.layout.HBox in project fx2048 by brunoborges.

the class Board method createScore.

private void createScore() {
    Label lblTitle = new Label("2048");
    lblTitle.getStyleClass().addAll("game-label", "game-title");
    Label lblSubtitle = new Label("FX");
    lblSubtitle.getStyleClass().addAll("game-label", "game-subtitle");
    HBox hFill = new HBox();
    HBox.setHgrow(hFill, Priority.ALWAYS);
    hFill.setAlignment(Pos.CENTER);
    VBox vScores = new VBox();
    HBox hScores = new HBox(5);
    vScore.setAlignment(Pos.CENTER);
    vScore.getStyleClass().add("game-vbox");
    Label lblTit = new Label("SCORE");
    lblTit.getStyleClass().addAll("game-label", "game-titScore");
    lblScore.getStyleClass().addAll("game-label", "game-score");
    lblScore.textProperty().bind(gameScoreProperty.asString());
    vScore.getChildren().addAll(lblTit, lblScore);
    VBox vRecord = new VBox(-5);
    vRecord.setAlignment(Pos.CENTER);
    vRecord.getStyleClass().add("game-vbox");
    Label lblTitBest = new Label("BEST");
    lblTitBest.getStyleClass().addAll("game-label", "game-titScore");
    lblBest.getStyleClass().addAll("game-label", "game-score");
    lblBest.textProperty().bind(gameBestProperty.asString());
    vRecord.getChildren().addAll(lblTitBest, lblBest);
    hScores.getChildren().addAll(vScore, vRecord);
    VBox vFill = new VBox();
    VBox.setVgrow(vFill, Priority.ALWAYS);
    vScores.getChildren().addAll(hScores, vFill);
    hTop.getChildren().addAll(lblTitle, lblSubtitle, hFill, vScores);
    hTop.setMinSize(gridWidth, TOP_HEIGHT);
    hTop.setPrefSize(gridWidth, TOP_HEIGHT);
    hTop.setMaxSize(gridWidth, TOP_HEIGHT);
    vGame.getChildren().add(hTop);
    HBox hTime = new HBox();
    hTime.setMinSize(gridWidth, GAP_HEIGHT);
    hTime.setAlignment(Pos.BOTTOM_RIGHT);
    lblTime.getStyleClass().addAll("game-label", "game-time");
    lblTime.textProperty().bind(clock);
    timer = new Timeline(new KeyFrame(Duration.ZERO, e -> {
        clock.set(LocalTime.now().minusNanos(time.toNanoOfDay()).format(fmt));
    }), new KeyFrame(Duration.seconds(1)));
    timer.setCycleCount(Animation.INDEFINITE);
    hTime.getChildren().add(lblTime);
    vGame.getChildren().add(hTime);
    getChildren().add(vGame);
    lblPoints.getStyleClass().addAll("game-label", "game-points");
    lblPoints.setAlignment(Pos.CENTER);
    lblPoints.setMinWidth(100);
    getChildren().add(lblPoints);
}
Also used : HBox(javafx.scene.layout.HBox) Timeline(javafx.animation.Timeline) Label(javafx.scene.control.Label) KeyFrame(javafx.animation.KeyFrame) VBox(javafx.scene.layout.VBox)

Example 15 with HBox

use of javafx.scene.layout.HBox in project Gargoyle by callakrsos.

the class FxControlsTreeItem method createNode.

/**
	 * 파일 트리를 생성하기 위한 노드를 반환한다.
	 *
	 * @Date 2015. 10. 14.
	 * @param f
	 * @return
	 * @User KYJ
	 */
public TreeItem<Node> createNode(final Node f) {
    TreeItem<Node> treeItem = new TreeItem<Node>(f) {

        private boolean isLeaf;

        private boolean isFirstTimeChildren = true;

        private boolean isFirstTimeLeaf = true;

        @Override
        public ObservableList<TreeItem<Node>> getChildren() {
            if (isFirstTimeChildren) {
                isFirstTimeChildren = false;
                super.getChildren().setAll(buildChildren(this));
            }
            return super.getChildren();
        }

        @Override
        public boolean isLeaf() {
            if (isFirstTimeLeaf) {
                isFirstTimeLeaf = false;
                Node f = getValue();
                if (f == null) {
                    isLeaf = true;
                } else if (f instanceof Control) {
                    isLeaf = ((Control) f).getChildrenUnmodifiable().isEmpty();
                } else if (f instanceof Parent) {
                    isLeaf = ((Parent) f).getChildrenUnmodifiable().isEmpty();
                } else if (f instanceof Shape)
                    isLeaf = true;
                else
                    isLeaf = false;
            }
            return isLeaf;
        }

        private ObservableList<TreeItem<Node>> buildChildren(TreeItem<Node> treeItem) {
            Node f = treeItem.getValue();
            if (f == null) {
                return FXCollections.emptyObservableList();
            }
            treeItem.setGraphic(new HBox(/* new CheckBox(), */
            getImage(getName(f))));
            List<Node> childrens = getChildrens(f);
            if (childrens == null || childrens.isEmpty()) {
                return FXCollections.emptyObservableList();
            } else {
                ObservableList<TreeItem<Node>> children = FXCollections.observableArrayList();
                for (Node child : childrens) {
                    children.add(createNode(child));
                }
                return children;
            }
        }
    };
    treeItem.setGraphic(new HBox(/* new CheckBox(), */
    getImage(getName(f))));
    return treeItem;
}
Also used : Control(javafx.scene.control.Control) HBox(javafx.scene.layout.HBox) Shape(javafx.scene.shape.Shape) TreeItem(javafx.scene.control.TreeItem) Parent(javafx.scene.Parent) Node(javafx.scene.Node)

Aggregations

HBox (javafx.scene.layout.HBox)54 Button (javafx.scene.control.Button)25 Insets (javafx.geometry.Insets)22 Label (javafx.scene.control.Label)22 Scene (javafx.scene.Scene)12 VBox (javafx.scene.layout.VBox)11 BorderPane (javafx.scene.layout.BorderPane)8 Node (javafx.scene.Node)7 InputTextField (io.bitsquare.gui.components.InputTextField)6 TextArea (javafx.scene.control.TextArea)6 Stage (javafx.stage.Stage)6 Popup (io.bitsquare.gui.main.overlays.popups.Popup)5 IOException (java.io.IOException)5 ObservableList (javafx.collections.ObservableList)5 FXML (javafx.fxml.FXML)5 ImageView (javafx.scene.image.ImageView)5 KeyFrame (javafx.animation.KeyFrame)4 Timeline (javafx.animation.Timeline)4 File (java.io.File)3 Group (javafx.scene.Group)3