473,387 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

getactioncode

This is my last chance, I am VERY new at this, I am trying to complete a checkerboard array, The code that I have compiles and runs, however I have to put in a getactionsource or something like that to make the clear button clear the field and the colors in the checkerboard back to white. I have attached the code that I have. I am thinking that I have to enter something like

Expand|Select|Wrap|Line Numbers
  1. boolean condtion = true;  
  2.  
  3. while(condition) 
  4.  
maybe a try or if statement
then

Expand|Select|Wrap|Line Numbers
  1. getactionsource ("clear");  
  2.  
  3. boardDisplay[i].setbackGround(Color.white); 
  4.  
but I am not clear, and I have been trying everything for over a week now and can't get it to work.
please help
Thanks
Attached Files
File Type: txt checkerboard.txt (3.0 KB, 385 views)
Mar 3 '11 #1
1 1274
Dheeraj Joshi
1,123 Expert 1GB
Get the action command on button click and figure out which button is fixed and perform appropriate actions.

Expand|Select|Wrap|Line Numbers
  1. if(e.getActionCommand().equals("Clear")){
  2.     for (int i=0; i<boardDisplay.length; i++){
  3.         boardDisplay[i].setBackground(Color.magenta);
  4.     }
  5.     return;
  6. }
  7.  
Regards
Dheeraj Joshi
Mar 4 '11 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.