public abstract class EnumControl extends Control
EnumControl
provides control over a set of discrete possible values, each represented by an object. In a graphical user interface, such a control might be represented by a set of buttons, each of which chooses one value or setting. For example, a reverb control might provide several preset reverberation settings, instead of providing continuously adjustable parameters of the sort that would be represented by FloatControl
objects. Controls that provide a choice between only two settings can often be implemented instead as a BooleanControl
, and controls that provide a set of values along some quantifiable dimension might be implemented instead as a FloatControl
with a coarse resolution. However, a key feature of EnumControl
is that the returned values are arbitrary objects, rather than numerical or boolean values. This means that each returned object can provide further information. As an example, the settings of a REVERB
control are instances of ReverbType
that can be queried for the parameter values used for each setting.
Modifier and Type | Class | Description |
---|---|---|
static class |
EnumControl.Type |
An instance of the EnumControl.Type inner class identifies one kind of enumerated control. |
Modifier | Constructor | Description |
---|---|---|
protected |
Constructs a new enumerated control object with the given parameters. |
Modifier and Type | Method | Description |
---|---|---|
Object |
getValue() |
Obtains this control's current value. |
Object[] |
getValues() |
Returns the set of possible values for this control. |
void |
setValue |
Sets the current value for the control. |
String |
toString() |
Returns a string representation of the enumerated control. |
protected EnumControl(EnumControl.Type type, Object[] values, Object value)
type
- the type of control represented this enumerated control objectvalues
- the set of possible values for the controlvalue
- the initial control valuepublic void setValue(Object value)
IllegalArgumentException
is thrown. Some controls require that their line be open before they can be affected by setting a value.value
- the desired new valueIllegalArgumentException
- if the value indicated does not fall within the allowable rangepublic Object getValue()
public Object[] getValues()
public String toString()
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/sound/sampled/EnumControl.html