Solved

More checkboxs using the same code

Posted on 2004-04-09
6
184 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
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 …
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…

832 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