| Author |
Changing background images
|
rahulash sharma
Greenhorn
Joined: Jan 05, 2009
Posts: 15
|
|
Hello
I am new to Swing. I am preparing a application in which i am displaying a image in panel. I want to add a functionality in which if i click on that image then background image change.
How can i do that .Please help.
Thanks in advance
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
In case you haven't done so, check out this example on displaying background images
http://faq.javaranch.com/java/BackgroundImageOnJPanel
So when you want to change the image,
1) assign the new image to the image instance
2) Call a revalidate and repaint on the panel so it will start displaying the new image.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
 |
|
|
subject: Changing background images
|
|
|