Search in sources :

Example 1 with FontIcon

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();
}
Also used : JFXTextArea(com.jfoenix.controls.JFXTextArea) Insets(javafx.geometry.Insets) JFXTextArea(com.jfoenix.controls.JFXTextArea) TextArea(javafx.scene.control.TextArea) FontIcon(org.kordamp.ikonli.javafx.FontIcon) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) RequiredFieldValidator(com.jfoenix.validation.RequiredFieldValidator) StackPane(javafx.scene.layout.StackPane)

Example 2 with FontIcon

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();
}
Also used : JFXTextField(com.jfoenix.controls.JFXTextField) FontIcon(org.kordamp.ikonli.javafx.FontIcon) JFXPasswordField(com.jfoenix.controls.JFXPasswordField) TextField(javafx.scene.control.TextField) JFXTextField(com.jfoenix.controls.JFXTextField) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) RequiredFieldValidator(com.jfoenix.validation.RequiredFieldValidator)

Example 3 with FontIcon

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();
}
Also used : ToggleButton(javafx.scene.control.ToggleButton) JFXToggleButton(com.jfoenix.controls.JFXToggleButton) JFXToggleButton(com.jfoenix.controls.JFXToggleButton) JFXToggleNode(com.jfoenix.controls.JFXToggleNode) FontIcon(org.kordamp.ikonli.javafx.FontIcon) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox)

Aggregations

Scene (javafx.scene.Scene)3 VBox (javafx.scene.layout.VBox)3 FontIcon (org.kordamp.ikonli.javafx.FontIcon)3 RequiredFieldValidator (com.jfoenix.validation.RequiredFieldValidator)2 JFXPasswordField (com.jfoenix.controls.JFXPasswordField)1 JFXTextArea (com.jfoenix.controls.JFXTextArea)1 JFXTextField (com.jfoenix.controls.JFXTextField)1 JFXToggleButton (com.jfoenix.controls.JFXToggleButton)1 JFXToggleNode (com.jfoenix.controls.JFXToggleNode)1 Insets (javafx.geometry.Insets)1 TextArea (javafx.scene.control.TextArea)1 TextField (javafx.scene.control.TextField)1 ToggleButton (javafx.scene.control.ToggleButton)1 StackPane (javafx.scene.layout.StackPane)1