Search in sources :

Example 11 with Text

use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.

the class JFXTextFieldOldSkin method createPromptNode.

private void createPromptNode() {
    promptText = new Text();
    promptText.setManaged(false);
    promptText.getStyleClass().add("text");
    promptText.visibleProperty().bind(usePromptText);
    promptText.fontProperty().bind(getSkinnable().fontProperty());
    promptText.textProperty().bind(getSkinnable().promptTextProperty());
    promptText.fillProperty().bind(promptTextFill);
    promptText.setLayoutX(1);
}
Also used : Text(javafx.scene.text.Text)

Example 12 with Text

use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.

the class JFXTextFieldOldSkin method createFloatingLabel.

private void createFloatingLabel() {
    if (((JFXTextField) getSkinnable()).isLabelFloat()) {
        if (promptText == null) {
            // get the prompt text node or create it
            boolean triggerFloatLabel = false;
            if (textPane.getChildren().get(0) instanceof Text)
                promptText = (Text) textPane.getChildren().get(0);
            else {
                Field field;
                try {
                    field = TextFieldSkin.class.getDeclaredField("promptNode");
                    field.setAccessible(true);
                    createPromptNode();
                    field.set(this, promptText);
                    // position the prompt node in its position
                    triggerFloatLabel = true;
                } catch (NoSuchFieldException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (SecurityException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalArgumentException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            promptContainer.getChildren().add(promptText);
            if (triggerFloatLabel) {
                promptText.setTranslateY(-textPane.getHeight());
                promptText.setTranslateX(-(promptText.getLayoutBounds().getWidth() * 0.15) / 2);
                promptText.setLayoutY(0);
                promptText.setScaleX(0.85);
                promptText.setScaleY(0.85);
            }
        }
        promptTextUpTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), -textPane.getHeight(), Interpolator.EASE_BOTH), new KeyValue(promptText.translateXProperty(), -(promptText.getLayoutBounds().getWidth() * 0.15) / 2, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleXProperty(), 0.85, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleYProperty(), 0.85, Interpolator.EASE_BOTH)))) {

            {
                setDelay(Duration.millis(0));
                setCycleDuration(Duration.millis(300));
            }
        };
        promptTextColorTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptTextFill, focusedLine.getStroke(), Interpolator.EASE_BOTH)))) {

            {
                setDelay(Duration.millis(0));
                setCycleDuration(Duration.millis(300));
            }

            protected void starting() {
                super.starting();
                oldPromptTextFill = promptTextFill.get();
            }

            ;
        };
        promptTextDownTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(promptText.translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleXProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(promptText.scaleYProperty(), 1, Interpolator.EASE_BOTH)))) {

            {
                setDelay(Duration.millis(0));
                setCycleDuration(Duration.millis(300));
            }
        };
        promptTextDownTransition.setOnFinished((finish) -> {
            promptText.setTranslateX(0);
            promptText.setTranslateY(0);
            promptText.setScaleX(1);
            promptText.setScaleY(1);
        });
        promptText.visibleProperty().unbind();
        promptText.visibleProperty().set(true);
    }
}
Also used : TextFieldSkin(com.sun.javafx.scene.control.skin.TextFieldSkin) JFXTextField(com.jfoenix.controls.JFXTextField) Text(javafx.scene.text.Text) Field(java.lang.reflect.Field) JFXTextField(com.jfoenix.controls.JFXTextField) CachedTransition(com.jfoenix.transitions.CachedTransition)

Example 13 with Text

use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.

the class JFXTextFieldSkin method createPromptNode.

private void createPromptNode() {
    promptText = new Text();
    promptText.setManaged(false);
    promptText.getStyleClass().add("text");
    promptText.visibleProperty().bind(usePromptText);
    promptText.fontProperty().bind(getSkinnable().fontProperty());
    promptText.textProperty().bind(getSkinnable().promptTextProperty());
    promptText.fillProperty().bind(promptTextFill);
    promptText.setLayoutX(1);
}
Also used : Text(javafx.scene.text.Text)

Example 14 with Text

use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.

the class JFXPasswordFieldOldSkin method createPromptNode.

private void createPromptNode() {
    promptText = new Text();
    promptText.setManaged(false);
    promptText.getStyleClass().add("text");
    promptText.visibleProperty().bind(usePromptText);
    promptText.fontProperty().bind(getSkinnable().fontProperty());
    promptText.textProperty().bind(getSkinnable().promptTextProperty());
    promptText.fillProperty().bind(promptTextFill);
    promptText.setLayoutX(1);
}
Also used : Text(javafx.scene.text.Text)

Example 15 with Text

use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.

the class JFXPasswordFieldSkin method createFloatingLabel.

private void createFloatingLabel() {
    if (((JFXPasswordField) getSkinnable()).isLabelFloat()) {
        if (promptText == null) {
            // get the prompt text node or create it
            boolean triggerFloatLabel = false;
            if (textPane.getChildren().get(0) instanceof Text)
                promptText = (Text) textPane.getChildren().get(0);
            else {
                Field field;
                try {
                    field = TextFieldSkin.class.getDeclaredField("promptNode");
                    field.setAccessible(true);
                    createPromptNode();
                    field.set(this, promptText);
                    // position the prompt node in its position
                    triggerFloatLabel = true;
                } catch (NoSuchFieldException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (SecurityException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalArgumentException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            promptText.getTransforms().add(promptTextScale);
            promptContainer.getChildren().add(promptText);
            if (triggerFloatLabel) {
                promptText.setTranslateY(-textPane.getHeight());
                promptTextScale.setX(0.85);
                promptTextScale.setY(0.85);
            }
        }
        promptTextUpTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), -textPane.getHeight(), Interpolator.EASE_BOTH), new KeyValue(promptTextScale.xProperty(), 0.85, Interpolator.EASE_BOTH), new KeyValue(promptTextScale.yProperty(), 0.85, Interpolator.EASE_BOTH)))) {

            {
                setDelay(Duration.millis(0));
                setCycleDuration(Duration.millis(240));
            }
        };
        promptTextColorTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptTextFill, ((JFXPasswordField) getSkinnable()).getFocusColor(), Interpolator.EASE_BOTH)))) {

            {
                setDelay(Duration.millis(0));
                setCycleDuration(Duration.millis(160));
            }

            protected void starting() {
                super.starting();
                oldPromptTextFill = promptTextFill.get();
            }

            ;
        };
        promptTextDownTransition = new CachedTransition(textPane, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(promptTextScale.xProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(promptTextScale.yProperty(), 1, Interpolator.EASE_BOTH)))) {

            {
                setDelay(Duration.millis(0));
                setCycleDuration(Duration.millis(240));
            }
        };
        promptTextDownTransition.setOnFinished((finish) -> {
            promptText.setTranslateY(0);
            promptTextScale.setX(1);
            promptTextScale.setY(1);
        });
        promptText.visibleProperty().unbind();
        promptText.visibleProperty().set(true);
    }
}
Also used : TextFieldSkin(com.sun.javafx.scene.control.skin.TextFieldSkin) JFXPasswordField(com.jfoenix.controls.JFXPasswordField) Text(javafx.scene.text.Text) JFXPasswordField(com.jfoenix.controls.JFXPasswordField) Field(java.lang.reflect.Field) CachedTransition(com.jfoenix.transitions.CachedTransition)

Aggregations

Text (javafx.scene.text.Text)313 VBox (javafx.scene.layout.VBox)55 TextFlow (javafx.scene.text.TextFlow)55 Label (javafx.scene.control.Label)51 Pane (javafx.scene.layout.Pane)34 Font (javafx.scene.text.Font)30 Button (javafx.scene.control.Button)25 Region (javafx.scene.layout.Region)25 Group (javafx.scene.Group)23 GridPane (javafx.scene.layout.GridPane)23 List (java.util.List)22 Rectangle (javafx.scene.shape.Rectangle)22 HBox (javafx.scene.layout.HBox)21 StackPane (javafx.scene.layout.StackPane)20 Color (javafx.scene.paint.Color)20 Insets (javafx.geometry.Insets)17 Canvas (javafx.scene.canvas.Canvas)17 Circle (javafx.scene.shape.Circle)17 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)17 ScrollPane (javafx.scene.control.ScrollPane)16