From 18d16578d31570af0943e35cd7c5c8d680fd0851 Mon Sep 17 00:00:00 2001 From: Sylvain Bertrand Date: Tue, 11 Jul 2023 11:35:16 -0500 Subject: [PATCH] SceneBuilder bugfix: Delay initialization of textNode. Also switch to using lookup instead of reflection. --- .../src/main/java/com/jfoenix/skins/JFXTextFieldSkin.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jfoenix/src/main/java/com/jfoenix/skins/JFXTextFieldSkin.java b/jfoenix/src/main/java/com/jfoenix/skins/JFXTextFieldSkin.java index 0cd42ada..7b6bbd78 100644 --- a/jfoenix/src/main/java/com/jfoenix/skins/JFXTextFieldSkin.java +++ b/jfoenix/src/main/java/com/jfoenix/skins/JFXTextFieldSkin.java @@ -59,7 +59,7 @@ public JFXTextFieldSkin(T textField) textPane = (Pane) this.getChildren().get(0); // get parent fields - textNode = ReflectionHelper.getFieldContent(TextFieldSkin.class, this, "textNode"); + textTranslateX = ReflectionHelper.getFieldContent(TextFieldSkin.class, this, "textTranslateX"); textRight = ReflectionHelper.getFieldContent(TextFieldSkin.class, this, "textRight"); @@ -107,6 +107,9 @@ protected void layoutChildren(final double x, final double y, final double w, fi private void updateTextPos() { + if (textNode == null) + textNode = getNode().lookup(".text"); + double textWidth = textNode.getLayoutBounds().getWidth(); final double promptWidth = promptText == null ? 0 : promptText.getLayoutBounds().getWidth(); switch (getSkinnable().getAlignment().getHpos())