javax.swing.plaf.basic
Class BasicLookAndFeel.AudioAction
java.lang.Object
javax.swing.AbstractAction
javax.swing.plaf.basic.BasicLookAndFeel.AudioAction
- All Implemented Interfaces:
- Action, ActionListener, Cloneable, EventListener, javax.sound.sampled.LineListener, Serializable
- Enclosing class:
- BasicLookAndFeel
- private class BasicLookAndFeel.AudioAction
- extends AbstractAction
- implements javax.sound.sampled.LineListener
Pass the name String to the super constructor. This is used
later to identify the Action and decide whether to play it or
not. Store the resource String. I is used to get the audio
resource. In this case, the resource is an audio file.
- Since:
- 1.4
Method Summary |
void |
actionPerformed(ActionEvent e)
Invoked when an action occurs. |
private void |
cancelCurrentSound(javax.sound.sampled.Clip clip)
If the parameter is null, or equal to the currently
playing sound, then cancel the currently playing sound. |
void |
update(javax.sound.sampled.LineEvent event)
|
audioResource
private String audioResource
audioBuffer
private byte[] audioBuffer
BasicLookAndFeel.AudioAction
public BasicLookAndFeel.AudioAction(String name,
String resource)
- The String is the name of the Action and
points to the audio resource.
The byte[] is a buffer of the audio bits.
actionPerformed
public void actionPerformed(ActionEvent e)
- Description copied from interface:
ActionListener
- Invoked when an action occurs.
- Specified by:
actionPerformed
in interface ActionListener
update
public void update(javax.sound.sampled.LineEvent event)
- Specified by:
update
in interface javax.sound.sampled.LineListener
cancelCurrentSound
private void cancelCurrentSound(javax.sound.sampled.Clip clip)
- If the parameter is null, or equal to the currently
playing sound, then cancel the currently playing sound.