Yodism
Yodism

Reputation: 247

Java: Show label when cursor hovered in a button

I'm currently working on a project in Java Netbeans but I don't know how to add label in a button when hovered. It will look like this:

enter image description here

So when I hovered my cursor on a button it will show a label. Sorry if I can't show any code because I don't have any idea on how to implement it. Any ideas?

Upvotes: 0

Views: 103

Answers (1)

Thiyagu
Thiyagu

Reputation: 17910

You can use setToolTipText

Example:

JButton button = new JButton("Click Me");
button.setToolTipText("Click this button to make something happen.");

Refer here

Upvotes: 1

Related Questions