A JButton tooltip example

Java/Swing FAQ: How do I set the help text (i.e., help text, balloon text, tooltip text) on a JButton?

Just call the setToolTipText method on the JButton. Here's a quick JButton tooltip display example:

// create a button with tooltip help text
JButton button = new JButton("Click Me");
button.setToolTipText("Click this button to make something happen.");

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.