Display Multiple icons on a single JButton after each click

A

arash470

Hi all..

I have a problem with JButtons in Java Swing!!

How do u add more than one icons ( like 10 icons) in a single button,
and when we keep clicking the button it displays the different icons
one after the other and starts repeating the icons again after
completing the gifs...

If any one of you could actually write a sample code for me i would be
greatful.. i have been going crazy over this..

Thanks for your help in advance.

ARS
 
H

hiwa

Hi all..

I have a problem with JButtons in Java Swing!!

How do u add more than one icons ( like 10 icons) in a single button,
and when we keep clicking the button it displays the different icons
one after the other and starts repeating the icons again after
completing the gifs...

If any one of you could actually write a sample code for me i would be
greatful.. i have been going crazy over this..

Thanks for your help in advance.

ARS

Make a single Image from your original ten Images and make an
ImageIcon from the resultant Image. --(a)

Repeat (a) choosing randomly from your original Images stock, in the
action listener of the button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top