Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display a tooltip according to mouse position? - JavaFX

I have a stackPane, filled with a Circle and a couple of lines.

I want to display a tooltip while hovering over the StackPane and the tooltip should contain the X/Y coords of the mouse.

I know how to get the Coords of the mouse, but I'm unable to find a way of showing the tool tip.

Can any of ou guys help me with that?..

like image 436
NexusTeddy Avatar asked Nov 30 '22 19:11

NexusTeddy


1 Answers

Anshul Parashar's answer probably works, but ToolTip also has a 'installation' static helper method to handle display on hover.

Assuming n is a Node:

Tooltip tp = new Tooltip("at stack tool");
Tooltip.install(n, tp);
like image 169
millmanorama Avatar answered Dec 04 '22 03:12

millmanorama