![]() |
Applet / Button problem.
I have a 200 x 200 applet with 3 buttons. My script generates a random number between 0-2 that is used as an index to my array (which contains the variable names of my buttons). I want it so that when the user clicks the button that was randomly chosen out of my array, it turns red, else it turns blue. I know how to detect if the random button was click, but I don't know to to then change the color of that button.
Script: :
import java.applet.Applet; |
did you try making an event listener class with a button object and then pass your button to that event listener and then in actionPerformed do the setBackground.
|
| All times are GMT -5. The time now is 2:11 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC