Skip to content

Commit

Permalink
SceneBuilder bugfix: Delay initialization of textNode.
Browse files Browse the repository at this point in the history
Also switch to using lookup instead of reflection.
  • Loading branch information
SylvainBertrand committed Jul 11, 2023
1 parent 47f53f4 commit 18d1657
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 18d1657

Please sign in to comment.