本文整理汇总了Java中com.jfoenix.controls.JFXTextField类的典型用法代码示例。如果您正苦于以下问题:Java JFXTextField类的具体用法?Java JFXTextField怎么用?Java JFXTextField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JFXTextField类属于com.jfoenix.controls包,在下文中一共展示了JFXTextField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addFileChoosers
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChoosers(final String fieldName, final String fileChooseLabel,
final String startDir, final FileChooser.ExtensionFilter... filters)
{
final WizardStep current = this.current;
final HBox box = new HBox();
final JFXButton button = new JFXButton(fileChooseLabel);
button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
final FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(fileChooseLabel);
fileChooser.setInitialDirectory(new File(startDir));
fileChooser.getExtensionFilters().addAll(filters);
this.current.getData().put(fieldName, new SimpleSetProperty<File>());
button.setOnAction(e -> current.getData().get(fieldName)
.setValue(fileChooser.showOpenMultipleDialog(MineIDE.primaryStage)));
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(button, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
final JFXTextField text = new JFXTextField();
text.setEditable(false);
((SimpleSetProperty<File>) this.current.getData().get(fieldName))
.addListener((SetChangeListener<File>) change ->
{
text.setText("");
change.getSet().forEach(file -> text.appendText(file.getAbsolutePath() + ", "));
text.setText(text.getText().substring(0, text.getText().length() - 2));
});
box.getChildren().addAll(text, button);
this.current.add(box, 1, this.current.getData().size() - 1);
return this;
}
示例2: 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());
}
示例3: bindToColor
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
public void bindToColor(final ObjectProperty<Color> color, final ObjectProperty<Color.Intensity> intensity, final boolean doColorBackground) {
final BiConsumer<Color, Color.Intensity> recolor = (newColor, newIntensity) -> {
final JFXTextField textField = (JFXTextField) lookup("#textField");
textField.setUnFocusColor(TRANSPARENT);
textField.setFocusColor(newColor.getColor(newIntensity));
if (doColorBackground) {
final Path shape = (Path) lookup("#shape");
shape.setFill(newColor.getColor(newIntensity.next(-1)));
shape.setStroke(newColor.getColor(newIntensity.next(-1).next(2)));
textField.setStyle("-fx-prompt-text-fill: rgba(255, 255, 255, 0.6); -fx-text-fill: " + newColor.getTextColorRgbaString(newIntensity) + ";");
textField.setFocusColor(newColor.getTextColor(newIntensity));
} else {
textField.setStyle("-fx-prompt-text-fill: rgba(0, 0, 0, 0.6);");
}
};
color.addListener(observable -> recolor.accept(color.get(), intensity.get()));
intensity.addListener(observable -> recolor.accept(color.get(), intensity.get()));
recolor.accept(color.get(), intensity.get());
}
示例4: build
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
@Override
public void build(GridPane pane) {
int row = 0;
Label fileLocationLabel = new Label("Location");
fileLocation = new JFXTextField();
fileLocation.setPromptText("path/to/file");
GridPane.setConstraints(fileLocationLabel, 1, ++row);
GridPane.setConstraints(fileLocation, 2, row);
Button buttonBrowse = new RaisedButton("Browse...");
buttonBrowse.setOnMouseClicked(click -> {
chooseFile(newFile -> fileLocation.setText(newFile.getAbsolutePath()));
});
GridPane.setConstraints(buttonBrowse, 1, ++row, 2, 1);
pane.getChildren().addAll(fileLocationLabel, fileLocation, buttonBrowse);
}
示例5: setup
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
private void setup() {
HBox topLane = new HBox();
nameSearcher = new JFXTextField();
nameSearcher.setPrefWidth(Short.MAX_VALUE);
nameSearcher.setPromptText("Name filter.");
TexturedButton addButton = new TexturedButton("assets/images/add.png", 24, "Force add a user.");
TexturedButton updateButton = new TexturedButton("assets/images/update.png", 24, "Refresh username.");
TexturedButton refreshButton = new TexturedButton("assets/images/refresh.png", 24, "Refresh list.");
TexturedButton removeButton = new TexturedButton("assets/images/remove.png", 24, "Remove user.");
setupTableView();
filterList();
nameSearcher.textProperty().addListener(change -> filterList());
addButton.setOnMouseClicked(click -> onUserAdd());
updateButton.setOnMouseClicked(click -> refreshUsername(userList.getSelectionModel().getSelectedItem()));
refreshButton.setOnMouseClicked(click -> filterList());
removeButton.setOnMouseClicked(click -> {
});
topLane.getChildren().addAll(nameSearcher, addButton, updateButton, refreshButton, removeButton);
setTop(topLane);
setCenter(userList);
}
示例6: setup
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
private void setup() {
HBox topLine = new HBox();
search = new JFXTextField();
search.setPromptText("Search group by name.");
search.setPrefWidth(Short.MAX_VALUE);
TexturedButton addButton = new TexturedButton("assets/images/add.png", 24, "Create a new group.");
TexturedButton refreshButton = new TexturedButton("assets/images/refresh.png", 24, "Remove selected group.");
TexturedButton removeButton = new TexturedButton("assets/images/remove.png", 24, "Remove selected group.");
setupGroupView();
fillGroupView();
search.textProperty().addListener(change -> fillGroupView());
addButton.setOnMouseClicked(click -> onAddGroup());
refreshButton.setOnMouseClicked(click -> onRefresh());
removeButton.setOnMouseClicked(click -> onRemoveGroup());
groupList.getSelectionModel().selectedIndexProperty().addListener(change -> updateSelected());
topLine.getChildren().addAll(search, addButton, refreshButton, removeButton);
getChildren().addAll(topLine, groupList);
}
示例7: addSearchField
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
public void addSearchField(JFXTextField searchTextField, JFXTreeTableView treeTable) {
searchTextField.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
treeTable.setPredicate(new Predicate<TreeItem<Student>>() {
@Override
public boolean test(TreeItem<Student> student) {
Boolean flag = student.getValue().studentUOB.getValue().contains(newValue)
|| student.getValue().studentName.getValue().contains(newValue)
|| student.getValue().studentYear.getValue().contains(newValue)
|| student.getValue().dept.getValue().contains(newValue)
|| student.getValue().allocatedPAT.getValue().contains(newValue)
|| student.getValue().emailAddress.getValue().contains(newValue);
return flag;
}
});
}
});
}
示例8: 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);
// });
}
}
示例9: isValidated
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
public boolean isValidated()
{
boolean rtn = true;
for (final JFXTextField field : this.toValidate)
if (!field.validate())
rtn = false;
return rtn;
}
示例10: 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;
}
示例11: 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;
}
示例12: addFileChooser
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChooser(final String fieldName, final String fileChooseLabel, final String startDir,
final FileChooser.ExtensionFilter... filters)
{
final WizardStep current = this.current;
final HBox box = new HBox();
final JFXButton button = new JFXButton(fileChooseLabel);
button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
final FileChooser fileChooser = new FileChooser();
fileChooser.setTitle(fileChooseLabel);
fileChooser.setInitialDirectory(new File(startDir));
fileChooser.getExtensionFilters().addAll(filters);
this.current.getData().put(fieldName, new SimpleObjectProperty<File>());
button.setOnAction(
e -> current.getData().get(fieldName).setValue(fileChooser.showOpenDialog(MineIDE.primaryStage)));
final Label label = new Label(fieldName);
GridPane.setHalignment(label, HPos.RIGHT);
GridPane.setHalignment(button, HPos.LEFT);
this.current.add(label, 0, this.current.getData().size() - 1);
final JFXTextField text = new JFXTextField();
text.setEditable(false);
this.current.getData().get(fieldName).addListener(
(ChangeListener<File>) (observable, oldValue, newValue) -> text.setText(newValue.getAbsolutePath()));
box.getChildren().addAll(text, button);
this.current.add(box, 1, this.current.getData().size() - 1);
return this;
}
示例13: initializeTextAid
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
private void initializeTextAid() {
final JFXTextField textField = (JFXTextField) lookup("#textField");
textField.textProperty().addListener((obs, oldText, newText) -> {
if (newText.contains(" ")) {
final String updatedString = newText.replace(" ", "_");
textField.setText(updatedString);
}
});
}
示例14: 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());
}
示例15: initialize
import com.jfoenix.controls.JFXTextField; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle rb) {
value = FXMLDocumentController.value;
vertex = new JFXTextField[value];
edges = new JFXTextField[value][value];
for(int i = 0; i < value; i++){
vertex[i] = new JFXTextField();
vertex[i].setFocusColor(Color.web("1A237E"));
vertex[i].setUnFocusColor(Color.web("#4d4d4d"));
vertex[i].setText(Integer.toString(i+1));
vertexGrid.add(vertex[i], 0, i);
}
for(int i = 0; i < value; i++)
for(int j = 0; j < value; j++){
edges[i][j] = new JFXTextField();
edges[i][j].setFocusColor(Color.web("#00838F"));
edges[i][j].setUnFocusColor(Color.web("#4d4d4d"));
edges[i][j].setPromptText("v"+(i+1)+"e"+(j+1));
if(i == j){
edges[i][j].setText("0");
edges[i][j].setEditable(false);
}
edgesGrid.add(edges[i][j], j, i);
}
}