Solved

change code to work with buttons instead of checkboxs

Posted on 2004-04-10
3
193 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
3 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 250 total points
ID: 10799111
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
 

Author Comment

by:Drop_of_Rain
ID: 10799817
Thanks for the help
Christopher
0
 
LVL 15

Expert Comment

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

Always glad to help . . .
Friend : Javatm
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ArrayLists in ArrayLists/HashMaps? 4 40
java set up 1 46
for i loop in grovy 1 32
Unable to start eclipse ? 17 83
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

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

12 Experts available now in Live!

Get 1:1 Help Now