Solved

changing a for statement from checkboxs to buttons

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Eclipse Neon and jdk 1.8.0 11 72
create a gui in perl 3 46
mockito example issue 8 38
Java DateChooser? 2 14
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now