use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class Overlay method addCloseButton.
protected void addCloseButton() {
if (!hideCloseButton) {
closeButton = new AutoTooltipButton(closeButtonText == null ? Res.get("shared.close") : closeButtonText);
closeButton.setOnAction(event -> doClose());
}
if (actionHandlerOptional.isPresent() || actionButtonText != null) {
actionButton = new AutoTooltipButton(actionButtonText == null ? Res.get("shared.ok") : actionButtonText);
actionButton.setDefaultButton(true);
// TODO app wide focus
// actionButton.requestFocus();
actionButton.setOnAction(event -> {
hide();
actionHandlerOptional.ifPresent(Runnable::run);
});
Pane spacer = new Pane();
HBox hBox = new HBox();
hBox.setSpacing(10);
if (!hideCloseButton)
hBox.getChildren().addAll(spacer, closeButton, actionButton);
else
hBox.getChildren().addAll(spacer, actionButton);
HBox.setHgrow(spacer, Priority.ALWAYS);
GridPane.setHalignment(hBox, HPos.RIGHT);
GridPane.setRowIndex(hBox, ++rowIndex);
GridPane.setColumnSpan(hBox, 2);
GridPane.setMargin(hBox, new Insets(buttonDistance, 0, 0, 0));
gridPane.getChildren().add(hBox);
} else if (!hideCloseButton) {
closeButton.setDefaultButton(true);
GridPane.setHalignment(closeButton, HPos.RIGHT);
if (!showReportErrorButtons)
GridPane.setMargin(closeButton, new Insets(buttonDistance, 0, 0, 0));
GridPane.setRowIndex(closeButton, ++rowIndex);
GridPane.setColumnIndex(closeButton, 1);
gridPane.getChildren().add(closeButton);
}
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class AwesomeFontDemo method start.
@Override
public void start(Stage primaryStage) {
Pane root = new FlowPane();
List<AwesomeIcon> values = new ArrayList<>(Arrays.asList(AwesomeIcon.values()));
values.sort((o1, o2) -> o1.name().compareTo(o2.name()));
for (AwesomeIcon icon : values) {
Label label = new AutoTooltipLabel();
Button button = new AutoTooltipButton(icon.name(), label);
AwesomeDude.setIcon(label, icon);
root.getChildren().add(button);
}
primaryStage.setScene(new Scene(root, 900, 850));
primaryStage.show();
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class BindingTest method start.
@Override
public void start(Stage primaryStage) {
VBox root = new VBox();
root.setSpacing(20);
Label label = new AutoTooltipLabel();
StringProperty txt = new SimpleStringProperty();
txt.set("-");
label.textProperty().bind(txt);
Button button = new AutoTooltipButton("count up");
button.setOnAction(e -> txt.set("counter " + counter++));
root.getChildren().addAll(label, button);
primaryStage.setScene(new Scene(root, 400, 400));
primaryStage.show();
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class AltCoinAccountsView method buildForm.
// /////////////////////////////////////////////////////////////////////////////////////////
// Base form
// /////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
GridPane.setValignment(tuple.first, VPos.TOP);
// noinspection unchecked
paymentAccountsListView = tuple.second;
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {
@Override
public ListCell<PaymentAccount> call(ListView<PaymentAccount> list) {
return new ListCell<PaymentAccount>() {
final Label label = new AutoTooltipLabel();
final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);
final Button removeButton = new AutoTooltipButton("", icon);
final AnchorPane pane = new AnchorPane(label, removeButton);
{
label.setLayoutY(5);
removeButton.setId("icon-button");
AnchorPane.setRightAnchor(removeButton, 0d);
}
@Override
public void updateItem(final PaymentAccount item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
label.setText(item.getAccountName());
removeButton.setOnAction(e -> onDeleteAccount(item));
setGraphic(pane);
} else {
setGraphic(null);
}
}
};
}
});
Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, Res.get("shared.addNewAccount"), Res.get("shared.ExportAccounts"), Res.get("shared.importAccounts"));
addAccountButton = tuple3.first;
exportButton = tuple3.second;
importButton = tuple3.third;
}
use of bisq.desktop.components.AutoTooltipButton in project bisq-desktop by bisq-network.
the class FormBuilder method addLabelButton.
public static Tuple2<Label, Button> addLabelButton(GridPane gridPane, int rowIndex, String labelText, String buttonTitle, double top) {
Label label = addLabel(gridPane, rowIndex, labelText, top);
Button button = new AutoTooltipButton(buttonTitle);
button.setDefaultButton(true);
GridPane.setRowIndex(button, rowIndex);
GridPane.setColumnIndex(button, 1);
gridPane.getChildren().add(button);
GridPane.setMargin(button, new Insets(top, 0, 0, 0));
return new Tuple2<>(label, button);
}
Aggregations