javax.sound.sampled
Class BooleanControl

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.sampled.Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control 
      extended by javax.sound.sampled.BooleanControl

public abstract class BooleanControl
extends Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control

A BooleanControl provides the ability to switch between two possible settings that affect a line's audio. The settings are boolean values (true and false). A graphical user interface might represent the control by a two-state button, an on/off switch, two mutually exclusive buttons, or a checkbox (among other possibilities). For example, depressing a button might activate a MUTE sample code for javax.sound.sampled.BooleanControl.Type.MUTE definition code for javax.sound.sampled.BooleanControl.Type.MUTE control to silence the line's audio.

As with other Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control subclasses, a method is provided that returns string labels for the values, suitable for display in the user interface.

Since:
1.3

Nested Class Summary
static class BooleanControl.Type sample code for javax.sound.sampled.BooleanControl.Type definition code for javax.sound.sampled.BooleanControl.Type
          An instance of the BooleanControl.Type class identifies one kind of boolean control.
 
Constructor Summary
protected BooleanControl sample code for javax.sound.sampled.BooleanControl.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean) definition code for javax.sound.sampled.BooleanControl.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean) (BooleanControl.Type sample code for javax.sound.sampled.BooleanControl.Type definition code for javax.sound.sampled.BooleanControl.Type  type, boolean initialValue)
          Constructs a new boolean control object with the given parameters.
protected BooleanControl sample code for javax.sound.sampled.BooleanControl.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean, java.lang.String, java.lang.String) definition code for javax.sound.sampled.BooleanControl.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean, java.lang.String, java.lang.String) (BooleanControl.Type sample code for javax.sound.sampled.BooleanControl.Type definition code for javax.sound.sampled.BooleanControl.Type  type, boolean initialValue, String sample code for java.lang.String definition code for java.lang.String  trueStateLabel, String sample code for java.lang.String definition code for java.lang.String  falseStateLabel)
          Constructs a new boolean control object with the given parameters.
 
Method Summary
 String sample code for java.lang.String definition code for java.lang.String getStateLabel sample code for javax.sound.sampled.BooleanControl.getStateLabel(boolean) definition code for javax.sound.sampled.BooleanControl.getStateLabel(boolean) (boolean state)
          Obtains the label for the specified state.
 boolean getValue sample code for javax.sound.sampled.BooleanControl.getValue() definition code for javax.sound.sampled.BooleanControl.getValue() ()
          Obtains this control's current value.
 void setValue sample code for javax.sound.sampled.BooleanControl.setValue(boolean) definition code for javax.sound.sampled.BooleanControl.setValue(boolean) (boolean value)
          Sets the current value for the control.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.sound.sampled.BooleanControl.toString() definition code for javax.sound.sampled.BooleanControl.toString() ()
          Provides a string representation of the control
 
Methods inherited from class javax.sound.sampled.Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control
getType sample code for javax.sound.sampled.Control.getType() definition code for javax.sound.sampled.Control.getType()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

BooleanControl sample code for javax.sound.sampled.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean, java.lang.String, java.lang.String) definition code for javax.sound.sampled.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean, java.lang.String, java.lang.String)

protected BooleanControl(BooleanControl.Type sample code for javax.sound.sampled.BooleanControl.Type definition code for javax.sound.sampled.BooleanControl.Type  type,
                         boolean initialValue,
                         String sample code for java.lang.String definition code for java.lang.String  trueStateLabel,
                         String sample code for java.lang.String definition code for java.lang.String  falseStateLabel)
Constructs a new boolean control object with the given parameters.

Parameters:
type - the type of control represented this float control object
initialValue - the initial control value
trueStateLabel - the label for the state represented by true, such as "true" or "on."
falseStateLabel - the label for the state represented by false, such as "false" or "off."

BooleanControl sample code for javax.sound.sampled.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean) definition code for javax.sound.sampled.BooleanControl(javax.sound.sampled.BooleanControl.Type, boolean)

protected BooleanControl(BooleanControl.Type sample code for javax.sound.sampled.BooleanControl.Type definition code for javax.sound.sampled.BooleanControl.Type  type,
                         boolean initialValue)
Constructs a new boolean control object with the given parameters. The labels for the true and false states default to "true" and "false."

Parameters:
type - the type of control represented by this float control object
initialValue - the initial control value
Method Detail

setValue sample code for javax.sound.sampled.BooleanControl.setValue(boolean) definition code for javax.sound.sampled.BooleanControl.setValue(boolean)

public void setValue(boolean value)
Sets the current value for the control. The default implementation simply sets the value as indicated. Some controls require that their line be open before they can be affected by setting a value.

Parameters:
value - desired new value.

getValue sample code for javax.sound.sampled.BooleanControl.getValue() definition code for javax.sound.sampled.BooleanControl.getValue()

public boolean getValue()
Obtains this control's current value.

Returns:
current value.

getStateLabel sample code for javax.sound.sampled.BooleanControl.getStateLabel(boolean) definition code for javax.sound.sampled.BooleanControl.getStateLabel(boolean)

public String sample code for java.lang.String definition code for java.lang.String  getStateLabel(boolean state)
Obtains the label for the specified state.

Returns:
the label for the specified state, such as "true" or "on" for true, or "false" or "off" for false.

toString sample code for javax.sound.sampled.BooleanControl.toString() definition code for javax.sound.sampled.BooleanControl.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Provides a string representation of the control

Overrides:
toString sample code for javax.sound.sampled.Control.toString() definition code for javax.sound.sampled.Control.toString() in class Control sample code for javax.sound.sampled.Control definition code for javax.sound.sampled.Control
Returns:
a string description