943,166 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1415
  • Java RSS
Apr 30th, 2010
0

How to change Image on JButton (Swing)?

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
satishynd is offline Offline
1 posts
since Apr 2010
Apr 30th, 2010
0
Re: How to change Image on JButton (Swing)?
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/tutor....html#contents
Last edited by Ezzaral; Apr 30th, 2010 at 2:49 pm.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 838
Posting Genius
Ezzaral is offline Offline
6,754 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Intensity thresholding issue.
Next Thread in Java Forum Timeline: NullPointer with Event handler problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC