Package docking.widgets.dialogs

# Class StringChoices

java.lang.Object
docking.widgets.dialogs.StringChoices

public class StringChoices extends Object
StringEnum objects represent a choice from a limited set of options.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `selected`
  `protected String[]`
  `values`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StringChoices(StringChoices strEnum)`
  Construct from another StringEnum instance.
  `StringChoices(String[] values)`
  Construct from an array of Strings.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `contains(String value)`
  Returns true if the given value is contained in this StringEnum
  `boolean`
  `equals(Object obj)`
  `String`
  `getSelectedValue()`
  Returns the currently selected value.
  `int`
  `getSelectedValueIndex()`
  Returns the index of the currently selected value;
  `String[]`
  `getValues()`
  Returns a list of all allowed string values.
  `int`
  `hashCode()`
  `int`
  `indexOf(String value)`
  Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.
  `void`
  `setSelectedValue(int index)`
  Sets the current value to the object at the given position as if indexed into the array returned by getValues().
  `void`
  `setSelectedValue(String value)`
  Sets the currentValue to the given value.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### values

    protected String[] values

  - ### selected

    protected int selected

- ## Constructor Details

  - ### StringChoices

    public StringChoices(String[] values)
    Construct from an array of Strings. The order of Strings is preserved.

  - ### StringChoices

    public StringChoices(StringChoices strEnum)
    Construct from another StringEnum instance.

- ## Method Details

  - ### getValues

    public String[] getValues()
    Returns a list of all allowed string values.

  - ### getSelectedValue

    public String getSelectedValue()
    Returns the currently selected value.

  - ### getSelectedValueIndex

    public int getSelectedValueIndex()
    Returns the index of the currently selected value;

  - ### contains

    public boolean contains(String value)
    Returns true if the given value is contained in this StringEnum
    Parameters:
      `value` - The value for which to search
    Returns:
      true if the given value is contained in this StringEnum

  - ### indexOf

    public int indexOf(String value)
    Returns the index of the given value in this StringEnum; -1 if the value is not contained herein.
    Parameters:
      `value` - The value for which to search
    Returns:
      the index of the given value in this StringEnum; -1 if the value is not contained herein.

  - ### setSelectedValue

    public void setSelectedValue(String value)
    Sets the currentValue to the given value.
    Throws:
      `IllegalArgumentException` - thrown if the given value is not one of the set of allowed values.

  - ### setSelectedValue

    public void setSelectedValue(int index)
    Sets the current value to the object at the given position as if indexed into the array returned by getValues().

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`
    See Also:
      - `Object.toString()`