Solved

changing a for statement from checkboxs to buttons

Posted on 2004-04-10
3
196 Views
Last Modified: 2010-03-31
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
Comment
Question by:Drop_of_Rain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 200 total points
ID: 10799118
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
 

Author Comment

by:Drop_of_Rain
ID: 10799777
Thanks for the help and answer,
Christopher
0
 
LVL 15

Expert Comment

by:Javatm
ID: 10799894
http://javatm.4t.com

Always glad to help . . .
Friend : Javatm
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How do I remove an object from a 3 62
Java Restore security prompts not working 10 261
ejb message driven bean mdb creation steps 2 54
running on tomcat not jboss eap 7.0 3 55
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues undeā€¦
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importingā€¦
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question