- java.lang.Object
-
- javax.sound.sampled.Control
-
- javax.sound.sampled.BooleanControl
-
public abstract class BooleanControl extends Control
ABooleanControl
provides the ability to switch between two possible settings that affect a line's audio. The settings are boolean values (true
andfalse
). 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
control to silence the line's audio.MUTE
As with other
subclasses, a method is provided that returns string labels for the values, suitable for display in the user interface.Control
- Since:
- 1.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
BooleanControl.Type
An instance of theBooleanControl.Type
class identifies one kind of boolean control.
-
Constructor Summary
Constructors Modifier Constructor and Description protected
BooleanControl(BooleanControl.Type type, boolean initialValue)
Constructs a new boolean control object with the given parameters.protected
BooleanControl(BooleanControl.Type type, boolean initialValue, String trueStateLabel, String falseStateLabel)
Constructs a new boolean control object with the given parameters.
-
Method Summary
Methods Modifier and Type Method and Description String
getStateLabel(boolean state)
Obtains the label for the specified state.boolean
getValue()
Obtains this control's current value.void
setValue(boolean value)
Sets the current value for the control.String
toString()
Provides a string representation of the control-
Methods inherited from class javax.sound.sampled.Control
getType
-
-
-
-
Constructor Detail
-
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
protected BooleanControl(BooleanControl.Type type, boolean initialValue)
Constructs a new boolean control object with the given parameters. The labels for thetrue
andfalse
states default to "true" and "false."- Parameters:
type
- the type of control represented by this float control objectinitialValue
- the initial control value
-
-
Method Detail
-
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
public 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" forfalse
.
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/sound/sampled/BooleanControl.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.