Solved

change code to work with buttons instead of checkboxs

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
runtime exception 2 41
ejb wildfly example 2 16
java example issue 3 20
java mysql insert application 14 25
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…
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 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.

807 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