I want to create text under the cursor in my javafx application. It should look like this. How do I do this?
Asked
Active
Viewed 561 times
-1
-
**setToolTip(ToolTip)** is maybe what you are looking for. Try http://docs.oracle.com/javafx/2/ui_controls/tooltip.htm for detailed help – ShayHaned Jun 30 '17 at 09:32
-
1Possible duplicate of [How to display a tooltip according to mouse position? - JavaFX](https://stackoverflow.com/questions/21159182/how-to-display-a-tooltip-according-to-mouse-position-javafx) – Aakash Verma Jun 30 '17 at 09:34
-
I used your solution and got floating tooltips in my desktop Aakash. – GiantSunflower Jun 30 '17 at 09:52
-
It looks like [this](https://www.dropbox.com/s/32bkw2krlzl4pe6/atStackTools.png?dl=0) now – GiantSunflower Jun 30 '17 at 09:58
-
Can you explain why the tooltips don't disappear? – GiantSunflower Jun 30 '17 at 10:36
-
Look at this ..try the second answer for convenience https://stackoverflow.com/questions/26854301/how-to-control-the-javafx-tooltips-delay – Aakash Verma Jul 01 '17 at 18:17
1 Answers
1
JavaFX Tooltip is the UI component used to display additional information for another component when you move the mouse over the surface of the component.
TextField field_userName= new TextField();
Tooltip tooltip_userName=new Tooltip("Enter user name");
// Set tooltip
field_userName.setTooltip(tooltip_userName);
// Or using Tooltip.install
Tooltip.install(field_userName, tooltip_userName);
// Uninstall tooltip
Tooltip.uninstall(field_userName, tooltip_userName);

Aakash Verma
- 3,705
- 5
- 29
- 66