Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

changing a for statement from checkboxs to buttons

How could this be modified to work with buttons instead of checkboxs?


for(int i = 0; i < checkboxes.length; i++) {
     checkboxes[i].setName("kp" + (i + 1));
     checkboxes[i].setActionCommand("kp" + (i + 1) + ".wav");
     choices.add(checkboxes[i]);//go through checkboxs and add them to choices
}


Would it be this

for(int i = 0; i < buttons.length; i++) {
     buttons[i].setName("kp" + (i + 1));
     buttons[i].setActionCommand("kp" + (i + 1) + ".wav");
     choices.add(buttons[i]);//go through checkboxs and add them to choices
}

0
Drop_of_Rain
Asked:
Drop_of_Rain
  • 2
1 Solution
 
JavatmCommented:
Yes, I dont see any problems, just dont forget to declare JButton buttons, because
your codes will not work if its not declared.

Hope that helps . . .
Javatm
0
 
Drop_of_RainAuthor Commented:
Thanks for the help and answer,
Christopher
0
 
JavatmCommented:
http://javatm.4t.com

Always glad to help . . .
Friend : Javatm
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now