954,178 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to change Image on JButton (Swing)?

I have a question.
I need to write a program to display a button with an image on it using Swing. the Image on the button has to change when the button is clicked.

I read somewhere about the image on button But is not sure how to change the image when the buttonclick event is envoked (do i need to put mouse click event or something?) help

satishynd
Newbie Poster
1 post since Apr 2010
Reputation Points: 10
Solved Threads: 0
 

There are a couple of different methods for setting various icons for the button, including setPressedIcon(). Here's a list: http://java.sun.com/docs/books/tutorial/uiswing/components/button.html#contents

Ezzaral
Posting Genius
Moderator
15,985 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You