javax.swing.plaf.basic
Class BasicLookAndFeel.AudioAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byjavax.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

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
private  byte[] audioBuffer
           
private  String audioResource
           
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
BasicLookAndFeel.AudioAction(String name, String resource)
          The String is the name of the Action and points to the audio resource.
 
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)
           
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

audioResource

private String audioResource

audioBuffer

private byte[] audioBuffer
Constructor Detail

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.

Method Detail

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.