Nawid
Nawid

Reputation: 11

Image changing while pressed

I have 2 images for a JComponent, one of an unpressed button, and one of a pressed button. When I click the button, I want the image to change for the pressed one, but only while I am clicking. Which means whenever I release the mouse button, the image goes back to the unepressed button.

How can I do this?

Upvotes: 0

Views: 23

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168825

Using a JButton, set the standard and pressed icons.

Upvotes: 1

Related Questions