Solved

More checkboxs using the same code

Posted on 2004-04-09
6
178 Views
Last Modified: 2010-03-31
Hello everyone out there hope all is going well.

I have 50 checkboxs named (kp1-kp50) these checkboxs are in a seperate JPanel named KP'S, In another JPanel next to it is another 50 checkboxs named (dm1-dm50) and others with names (kk1-kk20) and so on.

How could I use the code below to work with all of these checkboxs going in both directions
(IN (checkToAudio.put(cb, af)) and Out((AudioFile)return checkToAudio.get(cb))



public class CheckBoxesToAudioFiles {
Map checkToAudio;

public CheckBoxesToAudioFiles {
checkToAudio = new HashMap();
}

public void mapCheckboxToAudioFile(JCheckbox cb, AudioFile af) {
checkToAudio.put(cb, af);
}

public AudioFile getAudioFileForCheckbox(JCheckbox cb) {
(AudioFile)return checkToAudio.get(cb);
}

}
0
Comment
Question by:Drop_of_Rain
  • 4
  • 2
6 Comments
 

Author Comment

by:Drop_of_Rain
ID: 10793971
The reason I am asking this is because I might go in either direction. If you have seen any of my other questions.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 10794837
You can use the one instance of CheckBoxesToAudioFiles for all your checkboxes regardless of what panel they are in.
Though if you are storing the audio file names as the checkbox action command then the CheckBoxesToAudioFiles class is not really necessary.
0
 

Author Comment

by:Drop_of_Rain
ID: 10794913
I am going to have to have this be possible both ways. The reason is that a user will be able to choose which option(checkbox) they want in their workout.  If I have this be possible won;t the checkboxs need to be toggles. I say this because if a user chooses 1 option three times (example 1,4,5,1,3,2,1) the checkbox will become unchecked and then checked but only seeing it twice.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 92

Expert Comment

by:objects
ID: 10794930
how do you want the checkbox to worlk exactly?
0
 

Author Comment

by:Drop_of_Rain
ID: 10794942
I now realize that I am going to have 2 differt setups. 1 will be checkboxs and the other will be toggles.
0
 

Author Comment

by:Drop_of_Rain
ID: 10796156
Thanks again.

Christopher
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

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 second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

708 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

17 Experts available now in Live!

Get 1:1 Help Now