1

I would like to find out how I can link a JLabel to a JButton, so that when ever the button is hovered over, a piece of text appears. Sort of like a tool tip, indicating what this button does before it's clicked.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
Wendy O.
  • 191
  • 12

1 Answers1

3

Why ask for something "sort of like a tool tip" when you can use just that, a tool tip? Simply set the JButton's tool tip text via the JComponent setToolTipText(...) method (which JButton inherits) and you're there!

myButton.setToolTipText("Foo");
Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373