I want to see the text of JLabel when I hover over the label. The text explains what the lab开发者_JAVA百科el does in detail.
You would need to set the text of the tooltip by calling: setToolTipText()
More about tooltips in the tutorial: http://download.oracle.com/javase/tutorial/uiswing/components/tooltip.html
If you want to retrieve the Tooltip then you should use something like this:
JLabel label;
...//initialize label, etc
String text = label.getToolTipText();
In case you are asking how to set the Tooltip then you should do the opposite:
JLabel label;
...//initialize label, etc
label.setToolTipText("this is the description of the label");
精彩评论