Reputation: 107
Is it possible in java (or any other language that you know of) to get tool tip text (on mouseover). For example you mouseover something in an arbitrary application and a tiny tooltip pops up with some info. Can this be returned as a string to a program. It seems possible, i dont see why not but im no expert. Any help would be appreciated. Thanks.
Upvotes: 4
Views: 4773
Reputation: 2099
Have a look at How to Use Tool Tips.
Also see JComponent
getTooltipText() method.
Upvotes: 2
Reputation: 2969
JButton b = new JButton("button1");
b.setToolTipText("click here to submit");
here is an example on how to add a tooltop to a jbutton. but here is the thing you dont have to write action listners to your button so that pop menu will become visible on mouse over . tooltip text will be automatically work on mouseOver.
Upvotes: 3
Reputation: 6077
All the classes which extend JComponent
have these functionalities.
You do :
comp.setToolTipText("HEY!");
to set the text.
You do :
String tt = comp.getToolTipText();
to get the text.
Upvotes: 3