- java.lang.Object
- 
- javax.sound.sampled.Control
- 
- javax.sound.sampled.BooleanControl
 
 
- 
 public abstract class BooleanControl extends Control ABooleanControlprovides the ability to switch between two possible settings that affect a line's audio. The settings are boolean values (trueandfalse). 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 aMUTEcontrol to silence the line's audio.As with other Controlsubclasses, a method is provided that returns string labels for the values, suitable for display in the user interface.- Since:
- 1.3
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classBooleanControl.TypeAn instance of theBooleanControl.Typeclass identifies one kind of boolean control.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedBooleanControl(BooleanControl.Type type, boolean initialValue)Constructs a new boolean control object with the given parameters.protectedBooleanControl(BooleanControl.Type type, boolean initialValue, String trueStateLabel, String falseStateLabel)Constructs a new boolean control object with the given parameters.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetStateLabel(boolean state)Obtains the label for the specified state.booleangetValue()Obtains this control's current value.voidsetValue(boolean value)Sets the current value for the control.StringtoString()Provides a string representation of the control.
 
- 
- 
- 
Constructor Detail- 
BooleanControlprotected BooleanControl(BooleanControl.Type type, boolean initialValue, String trueStateLabel, 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"
 
 - 
BooleanControlprotected BooleanControl(BooleanControl.Type type, boolean initialValue) Constructs a new boolean control object with the given parameters. The labels for thetrueandfalsestates default to "true" and "false".- Parameters:
- type- the type of control represented by this float control object
- initialValue- the initial control value
 
 
- 
 - 
Method Detail- 
setValuepublic 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
 
 - 
getValuepublic boolean getValue() Obtains this control's current value.- Returns:
- current value
 
 - 
getStateLabelpublic String getStateLabel(boolean state) Obtains the label for the specified state.- Parameters:
- state- the state whose label will be returned
- Returns:
- the label for the specified state, such as "true" or "on" for
         true, or "false" or "off" forfalse
 
 
- 
 
-