本文整理汇总了Java中com.jfoenix.controls.JFXTextField.setText方法的典型用法代码示例。如果您正苦于以下问题:Java JFXTextField.setText方法的具体用法?Java JFXTextField.setText怎么用?Java JFXTextField.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfoenix.controls.JFXTextField
的用法示例。
在下文中一共展示了JFXTextField.setText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeTextFields
import com.jfoenix.controls.JFXTextField; //导入方法依赖的package包/类
private void initializeTextFields() {
final JFXTextField queryTextField = (JFXTextField) lookup("#query");
final JFXTextField commentTextField = (JFXTextField) lookup("#comment");
queryTextField.setText(query.getQuery());
commentTextField.setText(query.getComment());
query.queryProperty().bind(queryTextField.textProperty());
query.commentProperty().bind(commentTextField.textProperty());
queryTextField.setOnKeyPressed(CanvasController.getLeaveTextAreaKeyHandler(keyEvent -> {
if (keyEvent.getCode().equals(KeyCode.ENTER)) {
query.run();
}
}));
commentTextField.setOnKeyPressed(CanvasController.getLeaveTextAreaKeyHandler());
}
示例2: setUpCrewName
import com.jfoenix.controls.JFXTextField; //导入方法依赖的package包/类
@SuppressWarnings("restriction")
public void setUpCrewName() {
for (int i = 0; i < SIZE_OF_CREW; i++) {
int crew_id = personConfig.getCrew(i);
// TODO: will assign this person to the crew
String n = personConfig.getConfiguredPersonName(i, ALPHA_CREW);
SimpleStringProperty np = new SimpleStringProperty(n);
// System.out.println(" name is "+ 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) ->
// {
// System.out.println("textfield changed from " + oldValue + " to "
// + newValue);
// tf.setText(newValue);
// });
}
}
示例3: addString
import com.jfoenix.controls.JFXTextField; //导入方法依赖的package包/类
/**
* Add a simple String to a wizard step.
*
* @param fieldName
* @param defaultValue
* the default String the textfield will contains.
* @param prompt
* the text to show on the textfield prompt String.
* @param isRequired
* set the field required to continue
* @return
*/
@SuppressWarnings("unchecked")
public WizardStepBuilder addString(final String fieldName, final String defaultValue, final String prompt,
final boolean isRequired)
{
final JFXTextField text = new JFXTextField();
text.setPromptText(prompt);
if (isRequired)
{
final RequiredFieldValidator validator = new RequiredFieldValidator();
validator.setMessage(Translation.LANG.getTranslation("wizard.error.input_required"));
validator.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em")
.styleClass("error").build());
text.getValidators().add(validator);
}
text.focusedProperty().addListener((o, oldVal, newVal) ->
{
if (!newVal)
text.validate();
});
text.setText(defaultValue);
this.current.getData().put(fieldName, new SimpleStringProperty());
this.current.getData().get(fieldName).bind(text.textProperty());
this.current.addToValidate(text);
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(text, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
this.current.add(text, 1, this.current.getData().size() - 1);
return this;
}
示例4: addNumber
import com.jfoenix.controls.JFXTextField; //导入方法依赖的package包/类
/**
* Add a number only textfield to a wizard step. A {@link NumberValitor}
* will be added to the textfield.
*
* @param fieldName
* @param defaultValue
* the default number value of the textfield.
* @param prompt
* the text to show on the textfield prompt String.
* @return
*/
@SuppressWarnings("unchecked")
public WizardStepBuilder addNumber(final String fieldName, final Integer defaultValue, final String prompt)
{
final JFXTextField text = new JFXTextField();
text.setPromptText(prompt);
final NumberValidator numberValidator = new NumberValidator();
numberValidator.setMessage(Translation.LANG.getTranslation("wizard.error.not_number"));
numberValidator.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING)
.size("1em").styleClass("error").build());
text.getValidators().add(numberValidator);
text.setOnKeyReleased(e ->
{
if (!text.getText().equals(""))
text.validate();
});
text.setText(defaultValue.toString());
this.current.getData().put(fieldName, new SimpleStringProperty());
this.current.getData().get(fieldName).bind(text.textProperty());
this.current.addToValidate(text);
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(text, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
this.current.add(text, 1, this.current.getData().size() - 1);
return this;
}
示例5: setAndBindString
import com.jfoenix.controls.JFXTextField; //导入方法依赖的package包/类
public void setAndBindString(final StringProperty string) {
final JFXTextField textField = (JFXTextField) lookup("#textField");
textField.textProperty().unbind();
textField.setText(string.get());
string.bind(textField.textProperty());
}