com.jfoenix.controls.JFXTextField Java Examples

The following examples show how to use com.jfoenix.controls.JFXTextField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CrewEditorFX.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
	 * Set up crew name
	 */
	public void setUpCrewName() {
		for (int i = 0; i < SIZE_OF_CREW; i++) {
			// Generate the crew
			personConfig.getCrew(i);
			// TODO: will assign this person to the crew
			String n = personConfig.getConfiguredPersonName(i, ALPHA_CREW);
//			SimpleStringProperty np = new SimpleStringProperty(n);
			JFXTextField tf = new JFXTextField();
			// tf.setUnFocusColor(Color.rgb(255, 255, 255, 0.5));
			tf.setFocusColor(Color.rgb(225, 206, 30, 1));
			tf.setId("textfield");
			nameTF.add(tf);
			gridPane.add(tf, i + 1, NAME_ROW); // name's row = 1
			tf.setText(n);
			// np.bindBidirectional(tf.textProperty());
			// tf.textProperty().addListener((observable, oldValue, newValue) ->
			// {
			// tf.setText(newValue);
			// });
		}
	}
 
Example #2
Source File: JFXTimePickerSkin.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
@Override
protected void handleControlPropertyChanged(String p) {
    if ("DEFAULT_COLOR".equals(p)) {
        ((JFXTextField) getEditor()).setFocusColor(jfxTimePicker.getDefaultColor());
    } else if ("CONVERTER".equals(p)) {
        updateDisplayNode();
    } else if ("EDITOR".equals(p)) {
        getEditableInputNode();
    } else if ("SHOWING".equals(p)) {
        if (jfxTimePicker.isShowing()) {
            show();
        } else {
            hide();
        }
    } else if ("VALUE".equals(p)) {
        updateDisplayNode();
        jfxTimePicker.fireEvent(new ActionEvent());
    } else {
        super.handleControlPropertyChanged(p);
    }
}
 
Example #3
Source File: BalanceWithConfirmationTextField.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public BalanceWithConfirmationTextField() {
    textField = new JFXTextField();
    textField.setFocusTraversable(false);
    textField.setEditable(false);

    txConfidenceIndicator = new TxConfidenceIndicator();
    txConfidenceIndicator.setFocusTraversable(false);
    txConfidenceIndicator.setPrefSize(24, 24);
    txConfidenceIndicator.setId("funds-confidence");
    txConfidenceIndicator.setLayoutY(1);
    txConfidenceIndicator.setProgress(0);
    txConfidenceIndicator.setVisible(false);

    progressIndicatorTooltip = new Tooltip("-");
    Tooltip.install(txConfidenceIndicator, progressIndicatorTooltip);

    AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);
    AnchorPane.setRightAnchor(textField, 55.0);
    AnchorPane.setLeftAnchor(textField, 0.0);

    getChildren().addAll(textField, txConfidenceIndicator);
}
 
Example #4
Source File: InputDialog.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates a new path dialog.
 *
 * @param stage dialog stage
 */
public InputDialog(Stage stage) {
  super(stage);
  enterPressed = false;
  // set content
  text = new JFXTextField();
  title = new Text();
  // set layout
  JFXDialogLayout layout = new JFXDialogLayout();
  layout.setHeading(title);
  layout.setBody(text);
  // set alert
  setContent(layout);
  initModality(Modality.NONE);
  setOverlayClose(false);
  setAnimation(JFXAlertAnimation.CENTER_ANIMATION);
  // enter actions
  text.setOnKeyPressed(e -> {
    if (ENTER.match(e)) {
      enterPressed = true;
      close();
    }
  });
}
 
Example #5
Source File: ServiceEditFoundLuggageViewController.java    From Corendon-LostLuggage with MIT License 6 votes vote down vote up
/**  
 * When updating the fields there must be checked if the fields maybe contain
 * The preset: unknown message 
 * 
 * Note: for optimizing is there a array of fields used here.
 **/
private void checkForEmptyFields() {
    //check if one of the updated fields contains the "unknown" string
    if (size.getText().contains("unknown")){size.setText("0");}
    if (weight.getText().contains("unknown")){weight.setText("0");}
    if (signatures.getText().contains("unknown")){signatures.setText("");}
    
    //asign fields that can be checked in an loop in an array
    JFXTextField[] fields = {luggageTag,brand,passangerName,
        address,place,postalCode,country,email,phone,flight};
    
    //loop trough all the fields
    for (JFXTextField field : fields) {
        //check if it contains the unknown string
        if (field.getText().contains("unknown")){
            //clear it
            field.setText("");
        }
    }
}
 
Example #6
Source File: ServiceEditLostLuggageViewController.java    From Corendon-LostLuggage with MIT License 6 votes vote down vote up
/**  
 * When updating the fields there must be checked if the fields maybe contain
 * The preset: unknown message 
 * 
 * Note: for optimizing is there a array of fields used here.
 **/
private void checkForEmptyFields() {
    //check if one of the updated fields contains the "unknown" string
    if (size.getText().contains("unknown")){size.setText("0");}
    if (weight.getText().contains("unknown")){weight.setText("0");}
    if (signatures.getText().contains("unknown")){signatures.setText("");}
    
    //asign fields that can be checked in an loop in an array
    JFXTextField[] fields = {luggageTag,brand,passangerName,
        address,place,postalCode,country,email,phone,flight};
    
    //loop trough all the fields
    for (JFXTextField field : fields) {
        //check if it contains the unknown string
        if (field.getText().contains("unknown")){
            //clear it
            field.setText("");
        }
    }
}
 
Example #7
Source File: CredentialsInputDialog.java    From milkman with MIT License 6 votes vote down vote up
public CredentialsInputDialogFxml(CredentialsInputDialog controller){
	controller.title = new Label("Title");
	setHeading(controller.title);

	FxmlBuilder.VboxExt vbox = new FxmlBuilder.VboxExt();
	setBody(vbox);

	vbox.add(label("Username"));
	controller.username = vbox.add(new JFXTextField());
	controller.username.setValidators(requiredValidator());

	vbox.add(label("Password"));
	controller.password = vbox.add(new JFXPasswordField());
	controller.password.setValidators(requiredValidator());

	setActions(submit(controller::onSave), cancel(controller::onCancel));

}
 
Example #8
Source File: GitSyncDetailFactory.java    From milkman with MIT License 6 votes vote down vote up
@Override
public Node getSyncDetailsControls() {
	gitUrl = new JFXTextField();
	gitUrl.getValidators().add(new RequiredFieldValidator());
	username = new JFXTextField();
	username.getValidators().add(new RequiredFieldValidator());
	passwordOrToken = new JFXPasswordField();
	passwordOrToken.getValidators().add(new RequiredFieldValidator());

	usernameLbl = new Label("Username");
	passwordLbl = new Label("Password/Token");

	gitUrl.textProperty().addListener((obs, old, newValue) -> updateConnectionTypeLabels(newValue));

	return new VBox(new Label("Git Url"), gitUrl, usernameLbl, username, passwordLbl, passwordOrToken);
}
 
Example #9
Source File: TxIdTextField.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public TxIdTextField() {
    txConfidenceIndicator = new TxConfidenceIndicator();
    txConfidenceIndicator.setFocusTraversable(false);
    txConfidenceIndicator.setMaxSize(20, 20);
    txConfidenceIndicator.setId("funds-confidence");
    txConfidenceIndicator.setLayoutY(1);
    txConfidenceIndicator.setProgress(0);
    txConfidenceIndicator.setVisible(false);
    AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);
    AnchorPane.setTopAnchor(txConfidenceIndicator, 3.0);
    progressIndicatorTooltip = new Tooltip("-");
    txConfidenceIndicator.setTooltip(progressIndicatorTooltip);

    copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    AnchorPane.setRightAnchor(copyIcon, 30.0);

    Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));

    blockExplorerIcon = new Label();
    blockExplorerIcon.getStyleClass().addAll("icon", "highlight");
    blockExplorerIcon.setTooltip(tooltip);
    AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK);
    blockExplorerIcon.setMinWidth(20);
    AnchorPane.setRightAnchor(blockExplorerIcon, 52.0);
    AnchorPane.setTopAnchor(blockExplorerIcon, 4.0);

    textField = new JFXTextField();
    textField.setId("address-text-field");
    textField.setEditable(false);
    textField.setTooltip(tooltip);
    AnchorPane.setRightAnchor(textField, 80.0);
    AnchorPane.setLeftAnchor(textField, 0.0);
    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    getChildren().addAll(textField, copyIcon, blockExplorerIcon, txConfidenceIndicator);
}
 
Example #10
Source File: TextFieldEditorBase.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public Region createNode(T value, EventHandler<KeyEvent> keyEventsHandler, ChangeListener<Boolean> focusChangeListener) {
    textField = value == null ? new JFXTextField() : new JFXTextField(String.valueOf(value));
    textField.setOnKeyPressed(keyEventsHandler);
    textField.getValidators().addAll(validators);
    textField.focusedProperty().addListener(focusChangeListener);
    return textField;
}
 
Example #11
Source File: StringLangGUIOption.java    From MSPaintIDE with MIT License 5 votes vote down vote up
@Override
public Control getDisplay() {
    var textField = new JFXTextField();
    textField.textProperty().bindBidirectional(this.text);
    textField.setPromptText(this.promptText);
    textField.getStyleClass().add("theme-text");
    GridPane.setColumnIndex(textField, 1);
    return textField;
}
 
Example #12
Source File: ServiceInputLuggageViewController.java    From Corendon-LostLuggage with MIT License 5 votes vote down vote up
public String checkTextField(JFXTextField textField){
    if(textField.getText() != null && !textField.getText().isEmpty()){
          return textField.getText();
    }else{
        return "";
    }
}
 
Example #13
Source File: PrivateBinCollectionExporter.java    From milkman with MIT License 5 votes vote down vote up
@Override
public Node getRoot(Collection collection, Templater templater) {
	textField = new JFXTextField();
	textField.setEditable(false);
	burnCheckbox = new JFXCheckBox("Burn after reading");
	VBox vBox = new VBox(burnCheckbox, textField);
	return vBox;
}
 
Example #14
Source File: PrivateBinExporter.java    From milkman with MIT License 5 votes vote down vote up
@Override
public Node getRoot(RequestContainer request, Templater templater) {
	textField = new JFXTextField();
	textField.setEditable(false);
	burnCheckbox = new JFXCheckBox("Burn after reading");
	VBox vBox = new VBox(burnCheckbox, textField);
	return vBox;
}
 
Example #15
Source File: PrivateBinWorkspaceExporter.java    From milkman with MIT License 5 votes vote down vote up
@Override
public Node getRoot(Workspace workspace, Templater templater) {
	textField = new JFXTextField();
	textField.setEditable(false);
	burnCheckbox = new JFXCheckBox("Burn after reading");
	VBox vBox = new VBox(burnCheckbox, textField);
	return vBox;
}
 
Example #16
Source File: TextFieldWithIcon.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public TextFieldWithIcon() {
    textField = new JFXTextField();
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);
    setLeftAnchor(textField, 0d);
    setRightAnchor(textField, 0d);

    dummyTextField = new Label();
    dummyTextField.setWrapText(true);
    dummyTextField.setAlignment(Pos.CENTER_LEFT);
    dummyTextField.setTextAlignment(TextAlignment.LEFT);
    dummyTextField.setMouseTransparent(true);
    dummyTextField.setFocusTraversable(false);
    setLeftAnchor(dummyTextField, 0d);
    dummyTextField.setVisible(false);

    iconLabel = new Label();
    iconLabel.setLayoutX(0);
    iconLabel.setLayoutY(3);

    dummyTextField.widthProperty().addListener((observable, oldValue, newValue) -> {
        iconLabel.setLayoutX(dummyTextField.widthProperty().get() + 20);
    });

    getChildren().addAll(textField, dummyTextField, iconLabel);
}
 
Example #17
Source File: StringInputDialog.java    From milkman with MIT License 5 votes vote down vote up
public StringInputDialogFxml(StringInputDialog controller){
	setHeading(controller.title = label("Title"));

	var vbox = new FxmlBuilder.VboxExt();
	controller.promptLabel = vbox.add(label(""));
	controller.input = vbox.add(new JFXTextField());
	controller.input.setValidators(requiredValidator());
	setBody(vbox);

	setActions(submit(controller::onSave), cancel(controller::onCancel));
}
 
Example #18
Source File: GeneralSepaForm.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
ComboBox<Country> addCountrySelection() {
    HBox hBox = new HBox();

    hBox.setSpacing(10);
    ComboBox<Country> countryComboBox = new JFXComboBox<>();
    currencyTextField = new JFXTextField("");
    currencyTextField.setEditable(false);
    currencyTextField.setMouseTransparent(true);
    currencyTextField.setFocusTraversable(false);
    currencyTextField.setMinWidth(300);

    currencyTextField.setVisible(true);
    currencyTextField.setManaged(true);
    currencyTextField.setText(Res.get("payment.currencyWithSymbol", euroCurrency.getNameAndCode()));

    hBox.getChildren().addAll(countryComboBox, currencyTextField);

    addTopLabelWithVBox(gridPane, ++gridRow, Res.get("payment.bank.country"), hBox, 0);

    countryComboBox.setPromptText(Res.get("payment.select.bank.country"));
    countryComboBox.setConverter(new StringConverter<>() {
        @Override
        public String toString(Country country) {
            return country.name + " (" + country.code + ")";
        }

        @Override
        public Country fromString(String s) {
            return null;
        }
    });
    return countryComboBox;
}
 
Example #19
Source File: FxmlBuilder.java    From milkman with MIT License 5 votes vote down vote up
public static JFXTextField text(String id, String prompt, boolean lblFloat) {
	JFXTextField txt = new JFXTextField();
	txt.setId(id);
	txt.setPromptText(prompt);
	txt.setLabelFloat(lblFloat);
	return txt;
}
 
Example #20
Source File: CassandraRequestEditor.java    From milkman with MIT License 5 votes vote down vote up
public CassandraRequestEditorFxml(CassandraRequestEditor controller) {
	this.controller = controller;
	HBox.setHgrow(this, Priority.ALWAYS);
	controller.cassandraUrl = add(new JFXTextField(), true);
	controller.cassandraUrl.setId("cassandraUrl");
	controller.cassandraUrl.setPromptText("cql://host[:port][/keyspace]?dc=datacenter");
}
 
Example #21
Source File: TextFieldWithCopyIcon.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public TextFieldWithCopyIcon(String customStyleClass) {
    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    copyIcon.setOnMouseClicked(e -> {
        String text = getText();
        if (text != null && text.length() > 0) {
            String copyText;
            if (copyWithoutCurrencyPostFix) {
                String[] strings = text.split(" ");
                if (strings.length > 1)
                    copyText = strings[0]; // exclude the BTC postfix
                else
                    copyText = text;
            } else {
                copyText = text;
            }
            Utilities.copyToClipboard(copyText);
        }
    });
    textField = new JFXTextField();
    textField.setEditable(false);
    if (customStyleClass != null) textField.getStyleClass().add(customStyleClass);
    textField.textProperty().bindBidirectional(text);
    AnchorPane.setRightAnchor(copyIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 30.0);
    AnchorPane.setLeftAnchor(textField, 0.0);
    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    //TODO app wide focus
    //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());

    getChildren().addAll(textField, copyIcon);
}
 
Example #22
Source File: JdbcRequestEditor.java    From milkman with MIT License 5 votes vote down vote up
public JdbcRequestEditorFxml(JdbcRequestEditor controller) {
	this.controller = controller;
	HBox.setHgrow(this, Priority.ALWAYS);
	controller.jdbcUrl = add(new JFXTextField(), true);
	controller.jdbcUrl.setId("jdbcUrl");
	controller.jdbcUrl.setPromptText("jdbc:type://host[:port][/database][?parameters]");
}
 
Example #23
Source File: AddressTextField.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
public AddressTextField(String label) {
    JFXTextField textField = new BisqTextField();
    textField.setId("address-text-field");
    textField.setEditable(false);
    textField.setLabelFloat(true);
    textField.setPromptText(label);

    textField.textProperty().bind(address);
    String tooltipText = Res.get("addressTextField.openWallet");
    textField.setTooltip(new Tooltip(tooltipText));

    textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown());
    textField.setOnMouseReleased(event -> {
        if (wasPrimaryButtonDown)
            GUIUtil.showFeeInfoBeforeExecute(AddressTextField.this::openWallet);

        wasPrimaryButtonDown = false;
    });

    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    //TODO app wide focus
    //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());

    Label extWalletIcon = new Label();
    extWalletIcon.setLayoutY(3);
    extWalletIcon.getStyleClass().addAll("icon", "highlight");
    extWalletIcon.setTooltip(new Tooltip(tooltipText));
    AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN);
    extWalletIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));

    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    Tooltip.install(copyIcon, new Tooltip(Res.get("addressTextField.copyToClipboard")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> {
        if (address.get() != null && address.get().length() > 0)
            Utilities.copyToClipboard(address.get());
    }));

    AnchorPane.setRightAnchor(copyIcon, 30.0);
    AnchorPane.setRightAnchor(extWalletIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 55.0);
    AnchorPane.setLeftAnchor(textField, 0.0);

    getChildren().addAll(textField, copyIcon, extWalletIcon);
}
 
Example #24
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addPaymentGroup() {
    paymentAccountTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 1, Res.get("takeOffer.paymentInfo"));
    GridPane.setColumnSpan(paymentAccountTitledGroupBg, 2);

    final Tuple4<ComboBox<PaymentAccount>, Label, TextField, HBox> paymentAccountTuple = addComboBoxTopLabelTextField(gridPane,
            gridRow, Res.get("shared.selectTradingAccount"),
            Res.get("shared.paymentMethod"), Layout.FIRST_ROW_DISTANCE);

    paymentAccountsComboBox = paymentAccountTuple.first;
    HBox.setMargin(paymentAccountsComboBox, new Insets(Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
    paymentAccountsComboBox.setConverter(GUIUtil.getPaymentAccountsComboBoxStringConverter());
    paymentAccountsComboBox.setCellFactory(model.getPaymentAccountListCellFactory(paymentAccountsComboBox));
    paymentAccountsComboBox.setVisible(false);
    paymentAccountsComboBox.setManaged(false);
    paymentAccountsComboBox.setOnAction(e -> {
        PaymentAccount paymentAccount = paymentAccountsComboBox.getSelectionModel().getSelectedItem();
        if (paymentAccount != null) {
            maybeShowClearXchangeWarning(paymentAccount);
            maybeShowFasterPaymentsWarning(paymentAccount);
        }
        model.onPaymentAccountSelected(paymentAccount);
    });

    paymentMethodLabel = paymentAccountTuple.second;
    paymentMethodTextField = paymentAccountTuple.third;
    paymentMethodTextField.setMinWidth(250);
    paymentMethodTextField.setEditable(false);
    paymentMethodTextField.setMouseTransparent(true);
    paymentMethodTextField.setFocusTraversable(false);

    currencyTextField = new JFXTextField();
    currencyTextField.setMinWidth(250);
    currencyTextField.setEditable(false);
    currencyTextField.setMouseTransparent(true);
    currencyTextField.setFocusTraversable(false);

    final Tuple2<Label, VBox> tradeCurrencyTuple = getTopLabelWithVBox(Res.get("shared.tradeCurrency"), currencyTextField);
    HBox.setMargin(tradeCurrencyTuple.second, new Insets(5, 0, 0, 0));

    final HBox hBox = paymentAccountTuple.fourth;
    hBox.setSpacing(30);
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.setPadding(new Insets(10, 0, 18, 0));

    hBox.getChildren().add(tradeCurrencyTuple.second);
}
 
Example #25
Source File: KVCell.java    From MSPaintIDE with MIT License 4 votes vote down vote up
public JFXTextField getPath() {
    return path;
}
 
Example #26
Source File: CrewEditorFX.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 * 
 * @param simulationConfig       SimulationConfig
 * @param scenarioConfigEditorFX ScenarioConfigEditorFX
 */
public CrewEditorFX(SimulationConfig simulationConfig, ScenarioConfigEditorFX scenarioConfigEditorFX) {

	this.personConfig = simulationConfig.getPersonConfiguration();
	this.scenarioConfigEditorFX = scenarioConfigEditorFX;

	personalityArray = new boolean[4][SIZE_OF_CREW];

	nameTF = new ArrayList<JFXTextField>();

	genderList = new ArrayList<JFXComboBox<String>>();
	jobList = new ArrayList<JFXComboBox<String>>();
	countryList = new ArrayList<JFXComboBox<String>>();
	sponsorList = new ArrayList<JFXComboBox<String>>();

	createGUI();

}
 
Example #27
Source File: SettingController.java    From JFX-Browser with MIT License 4 votes vote down vote up
public void setCurrentUser(JFXTextField currentUser) {
	this.currentUser = currentUser;
}
 
Example #28
Source File: SettingController.java    From JFX-Browser with MIT License 4 votes vote down vote up
public JFXTextField getCurrentUser() {
	return currentUser;
}
 
Example #29
Source File: SignUpController.java    From JFX-Browser with MIT License 4 votes vote down vote up
public void setEmail(JFXTextField email) {
	this.email = email;
}
 
Example #30
Source File: SignUpController.java    From JFX-Browser with MIT License 4 votes vote down vote up
public JFXTextField getEmail() {
	return email;
}