use of javafx.scene.control.TextField in project JFoenix by jfoenixadmin.
the class TextFieldDemo method start.
@Override
public void start(Stage stage) throws Exception {
final VBox pane = new VBox();
pane.setSpacing(30);
pane.setStyle("-fx-background-color:WHITE;-fx-padding:40;");
pane.getChildren().add(new TextField());
JFXTextField field = new JFXTextField();
field.setLabelFloat(true);
field.setPromptText("Type Something");
pane.getChildren().add(field);
JFXTextField disabledField = new JFXTextField();
disabledField.setStyle(FX_LABEL_FLOAT_TRUE);
disabledField.setPromptText("I'm disabled..");
disabledField.setDisable(true);
pane.getChildren().add(disabledField);
JFXTextField validationField = new JFXTextField();
validationField.setPromptText("With Validation..");
RequiredFieldValidator validator = new RequiredFieldValidator();
validator.setMessage("Input Required");
FontIcon warnIcon = new FontIcon(FontAwesomeSolid.EXCLAMATION_TRIANGLE);
warnIcon.getStyleClass().add(ERROR);
validator.setIcon(warnIcon);
validationField.getValidators().add(validator);
validationField.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal) {
validationField.validate();
}
});
pane.getChildren().add(validationField);
JFXPasswordField passwordField = new JFXPasswordField();
passwordField.setStyle(FX_LABEL_FLOAT_TRUE);
passwordField.setPromptText("Password");
validator = new RequiredFieldValidator();
validator.setMessage("Password Can't be empty");
warnIcon = new FontIcon(FontAwesomeSolid.EXCLAMATION_TRIANGLE);
warnIcon.getStyleClass().add(ERROR);
validator.setIcon(warnIcon);
passwordField.getValidators().add(validator);
passwordField.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal) {
passwordField.validate();
}
});
pane.getChildren().add(passwordField);
final Scene scene = new Scene(pane, 600, 400, Color.WHITE);
scene.getStylesheets().add(TextFieldDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX TextField Demo ");
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
use of javafx.scene.control.TextField in project JFoenix by jfoenixadmin.
the class JFXDatePicker method initialize.
private void initialize() {
this.getStyleClass().add(DEFAULT_STYLE_CLASS);
try {
editorProperty();
Field editorField = DatePicker.class.getDeclaredField("editor");
editorField.setAccessible(true);
ReadOnlyObjectWrapper<TextField> editor = (ReadOnlyObjectWrapper<TextField>) editorField.get(this);
final FakeFocusJFXTextField editorNode = new FakeFocusJFXTextField();
this.focusedProperty().addListener((obj, oldVal, newVal) -> {
if (getEditor() != null) {
editorNode.setFakeFocus(newVal);
}
});
editorNode.activeValidatorWritableProperty().bind(activeValidatorProperty());
editor.set(editorNode);
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
}
use of javafx.scene.control.TextField in project POL-POM-5 by PlayOnLinux.
the class SearchBoxSkin method createTextField.
/**
* Creates a new {@link TextField} object fitted to the given container.
*
* @param container The container to which the text field is added
* @return The created text field
*/
private TextField createTextField(AnchorPane container) {
TextField searchField = new TextField();
searchField.getStyleClass().add("searchBar");
searchField.prefHeightProperty().bind(container.prefHeightProperty());
searchField.prefWidthProperty().bind(container.prefWidthProperty());
AnchorPane.setLeftAnchor(searchField, 0.0);
AnchorPane.setRightAnchor(searchField, 0.0);
return searchField;
}
use of javafx.scene.control.TextField in project POL-POM-5 by PlayOnLinux.
the class ClasspathRepositoryDetailsPanel method populate.
/**
* Populates the repository details step for the classpath repository
*/
private void populate() {
this.classpathField = new TextField();
Label classpathLabel = new Label(tr("Classpath:"));
classpathLabel.setLabelFor(classpathField);
HBox content = new HBox(classpathLabel, classpathField);
content.setId("addClasspathRepository");
HBox.setHgrow(classpathField, Priority.ALWAYS);
this.setCenter(content);
}
use of javafx.scene.control.TextField in project POL-POM-5 by PlayOnLinux.
the class StepRepresentationTextBox method drawStepContent.
@Override
protected void drawStepContent() {
super.drawStepContent();
setNextButtonEnabled(false);
textField = new TextField();
textField.textProperty().addListener((observable, oldValue, newValue) -> {
if (StringUtils.isBlank(newValue)) {
setNextButtonEnabled(false);
} else {
setNextButtonEnabled(true);
}
});
textField.setText(defaultValue);
textField.setLayoutX(10);
textField.setLayoutY(40);
this.addToContentPane(textField);
}
Aggregations