use of org.kordamp.ikonli.javafx.FontIcon in project JFoenix by jfoenixadmin.
the class TextAreaDemo method start.
@Override
public void start(Stage stage) {
VBox main = new VBox();
main.setSpacing(50);
TextArea javafxTextArea = new TextArea();
javafxTextArea.setPromptText("JavaFX Text Area");
main.getChildren().add(javafxTextArea);
JFXTextArea jfxTextArea = new JFXTextArea();
jfxTextArea.setPromptText("JFoenix Text Area :D");
jfxTextArea.setLabelFloat(true);
RequiredFieldValidator validator = new RequiredFieldValidator();
// NOTE adding error class to text area is causing the cursor to disapper
validator.setMessage("Please type something!");
FontIcon warnIcon = new FontIcon(FontAwesomeSolid.EXCLAMATION_TRIANGLE);
warnIcon.getStyleClass().add("error");
validator.setIcon(warnIcon);
jfxTextArea.getValidators().add(validator);
jfxTextArea.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal) {
jfxTextArea.validate();
}
});
main.getChildren().add(jfxTextArea);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 800, 600);
scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Button Demo");
stage.setScene(scene);
stage.show();
}
use of org.kordamp.ikonli.javafx.FontIcon 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 org.kordamp.ikonli.javafx.FontIcon in project JFoenix by jfoenixadmin.
the class ToggleButtonDemo method start.
@Override
public void start(Stage stage) throws Exception {
final VBox pane = new VBox();
pane.setSpacing(30);
pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;");
ToggleButton button = new ToggleButton("JavaFx Toggle");
pane.getChildren().add(button);
JFXToggleButton toggleButton = new JFXToggleButton();
toggleButton.setText("New Skin");
pane.getChildren().add(toggleButton);
JFXToggleNode node = new JFXToggleNode();
node.setStyle("-fx-padding: 10");
node.setGraphic(new FontIcon(FontAwesomeSolid.HEART));
pane.getChildren().add(node);
final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE"));
stage.setTitle("JFX Toggle Button Demo ");
scene.getStylesheets().add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
Aggregations