Search in sources :

Example 6 with TextField

use of javafx.scene.control.TextField in project jphp by jphp-compiler.

the class UXTextField method __construct.

@Signature
public void __construct(String text) {
    __wrappedObject = new TextField(text);
    fixContextMenu();
}
Also used : TextField(javafx.scene.control.TextField) Signature(php.runtime.annotation.Reflection.Signature)

Example 7 with TextField

use of javafx.scene.control.TextField in project Gargoyle by callakrsos.

the class EditableTableViewExam method start.

@Override
public void start(Stage primaryStage) throws Exception {
    Button btnExec = new Button("Exec.");
    Button btnAdd = new Button("Add ");
    Button btnRemove = new Button("Remove");
    Button btnSave = new Button("Save");
    btnAdd.setDisable(true);
    TextField textField = new TextField();
    HBox hBox = new HBox(5, textField, btnExec, btnAdd, btnRemove, btnSave);
    EditableTableView editableTableView = new EditableTableView(new Supplier<Connection>() {

        @Override
        public Connection get() {
            try {
                return DbUtil.getConnection();
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }
    });
    editableTableView.tableNameProperty().addListener((oba, oldval, newval) -> {
        btnAdd.setDisable(false);
    });
    //  editableTableView.execute("tbm_sm_realtime_search");
    btnExec.setOnAction(e -> {
        String tableName = textField.getText();
        try {
            editableTableView.readByTableName("select * from " + tableName, tableName);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    });
    btnAdd.setOnAction(ev -> {
        editableTableView.getItems().add(new HashMap<>());
        editableTableView.getSelectionModel().selectLast();
        editableTableView.scrollTo(editableTableView.getItems().size() - 1);
    });
    btnRemove.setOnAction(ev -> {
        editableTableView.getItems().removeAll(editableTableView.getSelectionModel().getSelectedItems());
    });
    btnSave.setOnAction(ev -> {
        try {
            editableTableView.save();
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    });
    editableTableView.setOnMouseClicked(ev -> {
        Map<ColumnExpression, ObjectProperty<ValueExpression>> selectedItem = editableTableView.getSelectionModel().getSelectedItem();
        System.out.println(selectedItem);
    });
    BorderPane root = new BorderPane(editableTableView);
    root.setTop(hBox);
    Scene value = new Scene(root);
    //  ".table-row{ -fx-background-color: red; }"
    //  value.getStylesheets().add(EditableTableViewExam.class.getResource("EditableTableViewExam.css").toExternalForm());
    primaryStage.setScene(value);
    primaryStage.show();
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) HBox(javafx.scene.layout.HBox) BorderPane(javafx.scene.layout.BorderPane) EditableTableView(com.kyj.fx.voeditor.visual.component.grid.EditableTableView) Connection(java.sql.Connection) Scene(javafx.scene.Scene) Button(javafx.scene.control.Button) ColumnExpression(com.kyj.fx.voeditor.visual.component.grid.EditableTableView.ColumnExpression) TextField(javafx.scene.control.TextField)

Example 8 with TextField

use of javafx.scene.control.TextField in project Gargoyle by callakrsos.

the class FilteredTreeItemExam method start.

@Override
public void start(Stage primaryStage) throws Exception {
    FilterableTreeItem<String> filterableTreeItem = new FilterableTreeItem<>("");
    filterableTreeItem.setExpanded(true);
    TreeView<String> treeView = new TreeView<>(filterableTreeItem);
    treeView.setShowRoot(false);
    treeView.setRoot(filterableTreeItem);
    BorderPane borderPane = new BorderPane(treeView);
    TextField value = new TextField();
    value.textProperty().addListener((oba, oldval, newval) -> {
        Callable<TreeItemPredicate<String>> func = () -> {
            Predicate<String> predicate = str -> str.indexOf(newval) >= 0;
            return TreeItemPredicate.<String>create(predicate);
        };
        ObjectBinding<TreeItemPredicate<String>> createObjectBinding = Bindings.createObjectBinding(func, hide);
        filterableTreeItem.predicateProperty().bind(createObjectBinding);
    });
    borderPane.setTop(value);
    Scene scene = new Scene(borderPane);
    primaryStage.setScene(scene);
    primaryStage.show();
    FilterableTreeItem<String> e = new FilterableTreeItem<>("ABC");
    //		e.getChildren().add(new FilterableTreeItem<>("DEF"));
    //		e.getChildren().add(new FilterableTreeItem<>("김aa"));
    //		e.getChildren().add(new FilterableTreeItem<>("김bb"));
    //		e.getChildren().add(new FilterableTreeItem<>("김cc"));
    //		filterableTreeItem.getChildren().add(e);
    //		filterableTreeItem.getChildren().add(new FilterableTreeItem<>("DEF"));
    //		filterableTreeItem.getChildren().add(new FilterableTreeItem<>("김DD"));
    //
    e.getSourceChildren().add(new FilterableTreeItem<>("DEF"));
    e.getSourceChildren().add(new FilterableTreeItem<>("김aa"));
    e.getSourceChildren().add(new FilterableTreeItem<>("김bb"));
    e.getSourceChildren().add(new FilterableTreeItem<>("김cc"));
    filterableTreeItem.getSourceChildren().add(e);
    filterableTreeItem.getSourceChildren().add(new FilterableTreeItem<>("DEF"));
    filterableTreeItem.getSourceChildren().add(new FilterableTreeItem<>("김DD"));
// filterableTreeItem.predicateProperty()
// .bind(Bindings.createObjectBinding(() ->
// TreeItemPredicate<String>.create(str -> str.indexOf("김") >= 0),
// hide));
}
Also used : BorderPane(javafx.scene.layout.BorderPane) FilterableTreeItem(com.kyj.fx.voeditor.visual.component.tree.FilterableTreeItem) Scene(javafx.scene.Scene) Predicate(java.util.function.Predicate) TreeItemPredicate(com.kyj.fx.voeditor.visual.component.tree.TreeItemPredicate) TreeItemPredicate(com.kyj.fx.voeditor.visual.component.tree.TreeItemPredicate) TreeView(javafx.scene.control.TreeView) TextField(javafx.scene.control.TextField)

Example 9 with TextField

use of javafx.scene.control.TextField in project bitsquare by bitsquare.

the class OfferDetailsWindow method addContent.

private void addContent() {
    int rows = 5;
    List<String> acceptedBanks = offer.getAcceptedBankIds();
    boolean showAcceptedBanks = acceptedBanks != null && !acceptedBanks.isEmpty();
    List<String> acceptedCountryCodes = offer.getAcceptedCountryCodes();
    boolean showAcceptedCountryCodes = acceptedCountryCodes != null && !acceptedCountryCodes.isEmpty();
    if (!takeOfferHandlerOptional.isPresent())
        rows++;
    if (showAcceptedBanks)
        rows++;
    if (showAcceptedCountryCodes)
        rows++;
    addTitledGroupBg(gridPane, ++rowIndex, rows, "Offer");
    String fiatDirectionInfo = ":";
    String btcDirectionInfo = ":";
    Offer.Direction direction = offer.getDirection();
    String currencyCode = offer.getCurrencyCode();
    if (takeOfferHandlerOptional.isPresent()) {
        addLabelTextField(gridPane, rowIndex, "Offer type:", formatter.getDirectionForTakeOffer(direction, currencyCode), Layout.FIRST_ROW_DISTANCE);
        fiatDirectionInfo = direction == Offer.Direction.BUY ? " to receive:" : " to spend:";
        btcDirectionInfo = direction == Offer.Direction.SELL ? " to receive:" : " to spend:";
    } else if (placeOfferHandlerOptional.isPresent()) {
        addLabelTextField(gridPane, rowIndex, "Offer type:", formatter.getOfferDirectionForCreateOffer(direction, currencyCode), Layout.FIRST_ROW_DISTANCE);
        fiatDirectionInfo = direction == Offer.Direction.SELL ? " to receive:" : " to spend:";
        btcDirectionInfo = direction == Offer.Direction.BUY ? " to receive:" : " to spend:";
    } else {
        addLabelTextField(gridPane, rowIndex, "Offer type:", formatter.getDirectionBothSides(direction, currencyCode), Layout.FIRST_ROW_DISTANCE);
    }
    if (takeOfferHandlerOptional.isPresent()) {
        addLabelTextField(gridPane, ++rowIndex, "Bitcoin amount" + btcDirectionInfo, formatter.formatCoinWithCode(tradeAmount));
        addLabelTextField(gridPane, ++rowIndex, formatter.formatVolumeLabel(currencyCode) + fiatDirectionInfo, formatter.formatVolumeWithCode(offer.getVolumeByAmount(tradeAmount)));
    } else {
        addLabelTextField(gridPane, ++rowIndex, "Bitcoin amount" + btcDirectionInfo, formatter.formatCoinWithCode(offer.getAmount()));
        addLabelTextField(gridPane, ++rowIndex, "Min. bitcoin amount:", formatter.formatCoinWithCode(offer.getMinAmount()));
        String volume = formatter.formatVolumeWithCode(offer.getOfferVolume());
        String minVolume = "";
        if (!offer.getAmount().equals(offer.getMinAmount()))
            minVolume = " (min. " + formatter.formatVolumeWithCode(offer.getMinOfferVolume()) + ")";
        addLabelTextField(gridPane, ++rowIndex, formatter.formatVolumeLabel(currencyCode) + fiatDirectionInfo, volume + minVolume);
    }
    if (takeOfferHandlerOptional.isPresent()) {
        addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatPrice(tradePrice));
    } else {
        Fiat price = offer.getPrice();
        if (offer.getUseMarketBasedPrice()) {
            addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatPrice(price) + " (distance from market price: " + formatter.formatPercentagePrice(offer.getMarketPriceMargin()) + ")");
        } else {
            addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatPrice(price));
        }
    }
    final PaymentMethod paymentMethod = offer.getPaymentMethod();
    final String offererPaymentAccountId = offer.getOffererPaymentAccountId();
    final PaymentAccount paymentAccount = user.getPaymentAccount(offererPaymentAccountId);
    String bankId = offer.getBankId();
    if (bankId == null || bankId.equals("null"))
        bankId = "";
    else
        bankId = " (" + bankId + ")";
    final boolean isSpecificBanks = paymentMethod.equals(PaymentMethod.SPECIFIC_BANKS);
    final boolean isNationalBanks = paymentMethod.equals(PaymentMethod.NATIONAL_BANK);
    final boolean isSepa = paymentMethod.equals(PaymentMethod.SEPA);
    if (offer.isMyOffer(keyRing) && offererPaymentAccountId != null && paymentAccount != null) {
        addLabelTextField(gridPane, ++rowIndex, "My trading account:", paymentAccount.getAccountName());
    } else {
        final String method = BSResources.get(paymentMethod.getId());
        if (isNationalBanks || isSpecificBanks || isSepa) {
            if (BankUtil.isBankIdRequired(offer.getCountryCode()))
                addLabelTextField(gridPane, ++rowIndex, "Payment method (offerer's bank ID):", method + bankId);
            else if (BankUtil.isBankNameRequired(offer.getCountryCode()))
                addLabelTextField(gridPane, ++rowIndex, "Payment method (offerer's bank name):", method + bankId);
        } else {
            addLabelTextField(gridPane, ++rowIndex, "Payment method:", method);
        }
    }
    if (showAcceptedBanks) {
        if (paymentMethod.equals(PaymentMethod.SAME_BANK)) {
            addLabelTextField(gridPane, ++rowIndex, "Bank ID (e.g. BIC or SWIFT):", acceptedBanks.get(0));
        } else if (isSpecificBanks) {
            String value = Joiner.on(", ").join(acceptedBanks);
            Tooltip tooltip = new Tooltip("Accepted banks: " + value);
            TextField acceptedBanksTextField = addLabelTextField(gridPane, ++rowIndex, "Accepted banks:", value).second;
            acceptedBanksTextField.setMouseTransparent(false);
            acceptedBanksTextField.setTooltip(tooltip);
        }
    }
    if (showAcceptedCountryCodes) {
        String countries;
        Tooltip tooltip = null;
        if (CountryUtil.containsAllSepaEuroCountries(acceptedCountryCodes)) {
            countries = "All Euro countries";
        } else {
            if (acceptedCountryCodes.size() == 1) {
                countries = CountryUtil.getNameAndCode(acceptedCountryCodes.get(0));
                tooltip = new Tooltip(countries);
            } else {
                countries = CountryUtil.getCodesString(acceptedCountryCodes);
                tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes));
            }
        }
        TextField acceptedCountries = addLabelTextField(gridPane, ++rowIndex, "Accepted taker countries:", countries).second;
        if (tooltip != null) {
            acceptedCountries.setMouseTransparent(false);
            acceptedCountries.setTooltip(tooltip);
        }
    }
    rows = 5;
    String paymentMethodCountryCode = offer.getCountryCode();
    if (paymentMethodCountryCode != null)
        rows++;
    if (offer.getOfferFeePaymentTxID() != null)
        rows++;
    addTitledGroupBg(gridPane, ++rowIndex, rows, "Details", Layout.GROUP_DISTANCE);
    addLabelTextFieldWithCopyIcon(gridPane, rowIndex, "Offer ID:", offer.getId(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Offerer's onion address:", offer.getOffererNodeAddress().getFullAddress());
    addLabelTextField(gridPane, ++rowIndex, "Creation date:", formatter.formatDateTime(offer.getDate()));
    addLabelTextField(gridPane, ++rowIndex, "Security deposit:", formatter.formatCoinWithCode(FeePolicy.getSecurityDeposit(offer)));
    if (paymentMethodCountryCode != null)
        addLabelTextField(gridPane, ++rowIndex, "Offerer's country of bank:", CountryUtil.getNameAndCode(paymentMethodCountryCode));
    addLabelTextFieldWithCopyIcon(gridPane, ++rowIndex, "Accepted arbitrators:", formatter.arbitratorAddressesToString(offer.getArbitratorNodeAddresses()));
    if (offer.getOfferFeePaymentTxID() != null)
        addLabelTxIdTextField(gridPane, ++rowIndex, "Offer fee transaction ID:", offer.getOfferFeePaymentTxID());
    if (placeOfferHandlerOptional.isPresent()) {
        addTitledGroupBg(gridPane, ++rowIndex, 1, "Commitment", Layout.GROUP_DISTANCE);
        addLabelTextField(gridPane, rowIndex, "I agree:", Offer.TAC_OFFERER, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
        addConfirmAndCancelButtons(true);
    } else if (takeOfferHandlerOptional.isPresent()) {
        addTitledGroupBg(gridPane, ++rowIndex, 1, "Contract", Layout.GROUP_DISTANCE);
        addLabelTextField(gridPane, rowIndex, "Terms and conditions:", Offer.TAC_TAKER, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
        addConfirmAndCancelButtons(false);
    } else {
        Button cancelButton = addButtonAfterGroup(gridPane, ++rowIndex, "Close");
        cancelButton.setOnAction(e -> {
            closeHandlerOptional.ifPresent(Runnable::run);
            hide();
        });
    }
}
Also used : Button(javafx.scene.control.Button) Overlay(io.bitsquare.gui.main.overlays.Overlay) PaymentMethod(io.bitsquare.payment.PaymentMethod) Popup(io.bitsquare.gui.main.overlays.popups.Popup) MainView(io.bitsquare.gui.main.MainView) AccountSettingsView(io.bitsquare.gui.main.account.settings.AccountSettingsView) CountryUtil(io.bitsquare.locale.CountryUtil) Coin(org.bitcoinj.core.Coin) LoggerFactory(org.slf4j.LoggerFactory) ArbitratorSelectionView(io.bitsquare.gui.main.account.content.arbitratorselection.ArbitratorSelectionView) Inject(javax.inject.Inject) PaymentAccount(io.bitsquare.payment.PaymentAccount) User(io.bitsquare.user.User) Insets(javafx.geometry.Insets) Navigation(io.bitsquare.gui.Navigation) Layout(io.bitsquare.gui.util.Layout) KeyRing(io.bitsquare.common.crypto.KeyRing) FeePolicy(io.bitsquare.btc.FeePolicy) BankUtil(io.bitsquare.locale.BankUtil) Tooltip(javafx.scene.control.Tooltip) BSFormatter(io.bitsquare.gui.util.BSFormatter) TextField(javafx.scene.control.TextField) Label(javafx.scene.control.Label) Logger(org.slf4j.Logger) Fiat(org.bitcoinj.utils.Fiat) Preferences(io.bitsquare.user.Preferences) Offer(io.bitsquare.trade.offer.Offer) List(java.util.List) FormBuilder(io.bitsquare.gui.util.FormBuilder) Tuple3(io.bitsquare.common.util.Tuple3) ImageView(javafx.scene.image.ImageView) BusyAnimation(io.bitsquare.gui.components.BusyAnimation) Optional(java.util.Optional) BSResources(io.bitsquare.locale.BSResources) Joiner(com.google.common.base.Joiner) AccountView(io.bitsquare.gui.main.account.AccountView) PaymentAccount(io.bitsquare.payment.PaymentAccount) Tooltip(javafx.scene.control.Tooltip) Offer(io.bitsquare.trade.offer.Offer) Button(javafx.scene.control.Button) Fiat(org.bitcoinj.utils.Fiat) PaymentMethod(io.bitsquare.payment.PaymentMethod) TextField(javafx.scene.control.TextField)

Example 10 with TextField

use of javafx.scene.control.TextField in project Gargoyle by callakrsos.

the class AbsoltePointFocusExam method start.

@Override
public void start(Stage stage) throws Exception {
    // 포커스
    ScrollPane scrPane = new ScrollPane();
    scrPane.setPrefWidth(ScrollPane.USE_COMPUTED_SIZE);
    BorderPane borderPane = new BorderPane(scrPane);
    Scene scene = new Scene(borderPane, Color.LINEN);
    VBox vbox = new VBox();
    VBox.setVgrow(vbox, Priority.ALWAYS);
    vbox.setPrefWidth(VBox.USE_PREF_SIZE);
    vbox.setPrefHeight(VBox.USE_COMPUTED_SIZE);
    for (int i = 0; i < 20; i++) {
        AnchorPane ancPane = new AnchorPane();
        AnchorPane ancPane2 = new AnchorPane();
        ancPane2.setLayoutY(500);
        TextField text1 = new TextField();
        TextField text2 = new TextField();
        text2.setLayoutY(800);
        Button btn = new Button("Focus" + i);
        btn.setOnMouseClicked(event -> {
            text2.requestFocus();
            double absolteY = FxUtil.getAbsolteY(vbox, text2) + text2.getHeight();
            scrPane.setVvalue((absolteY / vbox.getHeight()));
        });
        btn.setLayoutX(150);
        ancPane2.getChildren().add(text2);
        ancPane.getChildren().addAll(text1, btn, ancPane2);
        vbox.getChildren().add(ancPane);
    }
    scrPane.setContent(vbox);
    stage.setWidth(700);
    stage.setHeight(400);
    Label status = new Label();
    borderPane.setBottom(status);
    vbox.addEventFilter(MouseEvent.ANY, event -> {
        status.textProperty().set(String.format(" x: %s y : %s scene x : %s scene y : %s screen x :%s screen y : %s", event.getX(), event.getY(), event.getSceneX(), event.getSceneY(), event.getScreenX(), event.getScreenY()));
    });
    stage.setScene(scene);
    stage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) Button(javafx.scene.control.Button) ScrollPane(javafx.scene.control.ScrollPane) Label(javafx.scene.control.Label) TextField(javafx.scene.control.TextField) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) AnchorPane(javafx.scene.layout.AnchorPane)

Aggregations

TextField (javafx.scene.control.TextField)218 Label (javafx.scene.control.Label)98 Button (javafx.scene.control.Button)68 Insets (javafx.geometry.Insets)62 HBox (javafx.scene.layout.HBox)45 GridPane (javafx.scene.layout.GridPane)44 Scene (javafx.scene.Scene)42 VBox (javafx.scene.layout.VBox)34 InputTextField (bisq.desktop.components.InputTextField)32 Node (javafx.scene.Node)30 Stage (javafx.stage.Stage)27 List (java.util.List)26 ButtonType (javafx.scene.control.ButtonType)23 CheckBox (javafx.scene.control.CheckBox)23 Tooltip (javafx.scene.control.Tooltip)23 StackPane (javafx.scene.layout.StackPane)22 ArrayList (java.util.ArrayList)21 Dialog (javafx.scene.control.Dialog)21 BorderPane (javafx.scene.layout.BorderPane)19 ImageView (javafx.scene.image.ImageView)18