Solved

change code to fork with buttons instead of checkboxs

Posted on 2004-04-10
4
177 Views
Last Modified: 2010-03-31
How would this code be modified to work with buttons instead of checkboxs?



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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 250 total points
ID: 10799123
I've re-named some things :

public class ButtonsToAudioFiles {
  Map checkToAudio;

  public ButtonsToAudioFiles {
  checkToAudio = new HashMap();
  }

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

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

Hope that helps . . .
Javatm
0
 
LVL 92

Expert Comment

by:objects
ID: 10799136
Do you even need that class at all, what do you currently use it for?
0
 

Author Comment

by:Drop_of_Rain
ID: 10799515
objects, I will be using this class in the custom section of the program. Yes I need it.
0
 
LVL 15

Expert Comment

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

Always glad to help . . .
Friend : Javatm
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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…
The viewer will learn how to implement Singleton Design Pattern in Java.

762 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

20 Experts available now in Live!

Get 1:1 Help Now