I have a TextField
for which I want a Tooltip
to be shown under some circumstances.
After performing checks I run the followig code:
textFieldUsername.setTooltip(new Tooltip("Enter username!"));
textFieldUsername.getTooltip().setAutoHide(true);
textFieldUsername.getTooltip().show(textFieldUsername, 1, 1);
So when somebody tries to login with empty username he gets a prompting Tooltip
over the "username" TextField
.
But when it comes to action, the Tooltip
pops up in the top left corner of the screen.
Should I calculate coords of my scene, then add my TextField
coords to them, or there is a way to set these 1, 1
arguments from the call of show()
to be relative to the TextField
position?
public void show(Node ownerNode, double screenX, double screenY)
Shows the popup at the specified x,y location relative to the screen." – Puppetry