Reputation: 13
I'm looking for a way to display a baloon tip when i mouse-over a textfield in Java, for example to guide the user in the way to put some specific data: ID: 0-0000-000 or something like that...
Is there a way to do that, other than jOptionPane?
Upvotes: 1
Views: 167
Reputation: 45060
You can use the JtextField#setToolTipText(tipText)
method for that(note that JTextField extends JTextComponent which extends JComponent).
String toolTip = "Welcome";
myTextField.setToolTipText(toolTip);
Have a look at the javadocs for detailed explanation on using ToolTips.
Upvotes: 3