use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.
the class JFXPasswordFieldSkinAndroid 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);
}
use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.
the class JFXTextAreaSkinAndroid method createFloatingLabel.
private void createFloatingLabel() {
if (((JFXTextArea) getSkinnable()).isLabelFloat()) {
if (promptText == null) {
// get the prompt text node or create it
boolean triggerFloatLabel = false;
if (((Region) scrollPane.getContent()).getChildrenUnmodifiable().get(0) instanceof Text)
promptText = (Text) ((Region) scrollPane.getContent()).getChildrenUnmodifiable().get(0);
else {
Field field;
try {
field = TextAreaSkin.class.getDeclaredField("promptNode");
field.setAccessible(true);
createPromptNode();
field.set(this, promptText);
// position the prompt node in its position
triggerFloatLabel = true;
oldPromptTextFill = promptTextFill.get();
} 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();
}
}
// fixed issue text area is being resized when the content is excedeing its width
promptText.wrappingWidthProperty().addListener((o, oldval, newVal) -> {
if (newVal.doubleValue() > getSkinnable().getWidth())
promptText.setWrappingWidth(getSkinnable().getWidth());
});
promptText.getTransforms().add(promptTextScale);
promptContainer.getChildren().add(promptText);
if (triggerFloatLabel) {
promptText.setTranslateY(-promptText.getBoundsInLocal().getHeight() - 2);
promptTextScale.setX(0.85);
promptTextScale.setY(0.85);
}
}
// create prompt animations
promptTextUpTransition = new CachedTransition(promptContainer, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptText.translateYProperty(), -promptText.getLayoutBounds().getHeight() - 2, 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(promptContainer, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptTextFill, ((JFXTextArea) getSkinnable()).getFocusColor(), Interpolator.EASE_BOTH)))) {
{
setDelay(Duration.millis(0));
setCycleDuration(Duration.millis(160));
}
protected void starting() {
super.starting();
oldPromptTextFill = promptTextFill.get();
}
;
};
promptTextDownTransition = new CachedTransition(promptContainer, 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);
}
}
use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.
the class JFXTextFieldSkinAndroid 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();
}
}
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, ((JFXTextField) 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);
}
}
use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.
the class JFXSliderSkinOLD method initialize.
private void initialize() {
isHorizontal = getSkinnable().getOrientation() == Orientation.HORIZONTAL;
thumb = new Circle();
thumb.setStrokeWidth(2);
thumb.setRadius(7);
thumb.setFill(thumbColor);
thumb.setStroke(thumbColor);
thumb.getStyleClass().setAll("thumb");
track = new Line();
track.setStroke(trackColor);
track.setStrokeWidth(3);
track.getStyleClass().setAll("track");
coloredTrack = new Line();
coloredTrack.strokeProperty().bind(thumb.strokeProperty());
coloredTrack.strokeWidthProperty().bind(track.strokeWidthProperty());
sliderValue = new Text();
sliderValue.setStroke(Color.WHITE);
sliderValue.setFont(new Font(10));
sliderValue.getStyleClass().setAll("sliderValue");
animatedThumb = new StackPane();
animatedThumb.getChildren().add(sliderValue);
getChildren().clear();
getChildren().addAll(track, coloredTrack, animatedThumb, thumb);
}
use of javafx.scene.text.Text in project JFoenix by jfoenixadmin.
the class JFXTextAreaOldSkin method createFloatingLabel.
private void createFloatingLabel() {
if (((JFXTextArea) getSkinnable()).isLabelFloat()) {
if (promptText == null) {
// get the prompt text node or create it
boolean triggerFloatLabel = false;
if (((Region) scrollPane.getContent()).getChildrenUnmodifiable().get(0) instanceof Text)
promptText = (Text) ((Region) scrollPane.getContent()).getChildrenUnmodifiable().get(0);
else {
Field field;
try {
field = TextAreaSkin.class.getDeclaredField("promptNode");
field.setAccessible(true);
createPromptNode();
field.set(this, promptText);
// position the prompt node in its position
triggerFloatLabel = true;
oldPromptTextFill = promptTextFill.get();
} 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();
}
}
promptTextGroup = new Group(promptText);
promptContainer.getChildren().add(promptTextGroup);
StackPane.setAlignment(promptTextGroup, Pos.TOP_LEFT);
// MUST KEEP: having transparent border fix the blurring effect on focus
promptContainer.setStyle("-fx-border-color:TRANSPARENT");
if (triggerFloatLabel) {
promptContainer.setTranslateY(-promptText.getLayoutBounds().getHeight() - 5);
promptText.setScaleX(0.85);
promptText.setScaleY(0.85);
}
}
// create prompt animations
promptTextUpTransition = new CachedTransition(promptContainer, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptContainer.translateYProperty(), -promptText.getLayoutBounds().getHeight() - 5, 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(promptContainer, 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(promptContainer, new Timeline(new KeyFrame(Duration.millis(1300), new KeyValue(promptContainer.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) -> {
promptContainer.setTranslateY(0);
promptText.setScaleX(1);
promptText.setScaleY(1);
});
promptText.visibleProperty().unbind();
promptText.visibleProperty().set(true);
}
}
Aggregations