| Author |
How to make JButtons working together?
|
Pan Niko
Ranch Hand
Joined: Mar 19, 2011
Posts: 86
|
|
Hello,
How is possible to make JButtons who have same ImageIcon and are consecutive to change for example image when you click one of them?
Consecutive i mean(1s are JButtons with same image):
0000000
0010000
0010010
0000010
1000010
0000000
or
0000000
0000000
1111000
0000000
0001100
0000000
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
|
I don't know where you're stuck (since you didn't tell us!) all I can so is suggest some tutorials.
http://download.oracle.com/javase/tutorial/uiswing/components/button.html
http://download.oracle.com/javase/tutorial/uiswing/events/actionlistener.html
http://download.oracle.com/javase/tutorial/uiswing/components/icon.html
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Pan Niko
Ranch Hand
Joined: Mar 19, 2011
Posts: 86
|
|
|
I didnt start coding yet, im just thinking it. I have stuck at the point how to make those JButtons "group"
|
 |
Jan Hoppmann
Ranch Hand
Joined: Jul 19, 2010
Posts: 99
|
|
What you want to do here seems like a finite state machine to me, so: yup, it's possible.
If you want to change the buttons which have the images randomly it's a bit less complicated.
|
Life is full of choices. Sometimes you make the good ones, and sometimes you have to kill all the witnesses.
|
 |
 |
|
|
subject: How to make JButtons working together?
|
|
|