0

I have an AutoCompletionTextFieldBinding object for one of my TextFields. The position of the AutoCompletePopup is offset from the TextField by a good margin, from other images of the popup I can see this is NOT supposed to be the case. What could possible reasons for this be? The TextField is inside an AnchorPane with a padding of 10 on the bottom. I figured that might be it and have tried removing the padding but the issue persists. Is there a way to override the position of the popup? I have tried getting the AutoCompletePopup and setting the styling on it via:

binding.getTextFieldBinding().getAutoCompletionPopup().setStyle("-fx-padding: 100 0 0 0;");

This was just to see if I could see a difference, the above styling makes no visible difference in the position of the popup. Is it possible to set the position through styling to begin with? I am okay with a "hacky" solution that simply move the popup up by a few pixels.

An image of the popup position can be seen here: Visual problem

EDIT: If any additional information is necessary, let me know.

erik p
  • 360
  • 3
  • 15

1 Answers1

2

The pop up should be directly under the text field by default. Maybe a "hacky" solution is to just use the translateYProperty like this:

styling.css:

.auto-complete-popup {
    -fx-translate-y: -10; /* Move the pop up 10 pixels higher */
}
anko
  • 1,628
  • 1
  • 6
  • 14
  • The issue seems to be CSS-related, as disabling the stylesheet applied to the scene fixes the issue. I tried adding the styling to my current CSS file and it fixes the problem for me! Thank you! – erik p May 14 '21 at 16:09