Solved

changing a for statement from checkboxs to buttons

Posted on 2004-04-10
3
188 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Timer (static) 9 43
Java Loop 6 59
eclipse buid path vs tomcat lib path 10 22
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 32
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

776 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