Class BooleanControl
java.lang.Object
javax.sound.sampled.Control
javax.sound.sampled.BooleanControl
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 control to
silence the line's audio.
As with other 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
Nested ClassesModifier and TypeClassDescriptionstatic classAn instance of theBooleanControl.Typeclass identifies one kind of boolean control. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBooleanControl(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 Summary
Modifier and TypeMethodDescriptiongetStateLabel(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.toString()Returns a string representation of the boolean control.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
BooleanControl
protected 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 objectinitialValue- the initial control valuetrueStateLabel- the label for the state represented bytrue, such as "true" or "on"falseStateLabel- the label for the state represented byfalse, such as "false" or "off"
-
BooleanControl
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 objectinitialValue- the initial control value
-
-
Method Details
-
setValue
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
public boolean getValue()Obtains this control's current value.- Returns:
- current value
-
getStateLabel
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
-
toString
-