Class ListChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ListChooser extends JDialog
This modal dialog lets the user choose any number of items from a supplied list. Items not selected are removed from the list.
See Also:
  • Constructor Details

    • ListChooser

      public ListChooser(String title, String text, ActionListener listener)
      Constructs a dialog with the specified title and text.
      Parameters:
      title - the title of the dialog
      text - the label text
    • ListChooser

      public ListChooser(String title, String text, Component owner, ActionListener listener)
      Constructs a dialog with the specified title, text and owner.
      Parameters:
      title - the title of the dialog
      text - the label text
      owner - the component that owns the dialog (may be null)
    • ListChooser

      public ListChooser(String title, String text, JDialog owner, ActionListener listener)
      Constructs a dialog with the specified title, text and owner.
      Parameters:
      title - the title of the dialog
      text - the label text
      owner - the component that owns the dialog (may be null)
      listener - an ActionListener, required for JavaScript; optional for Java -- see XMLControlElement for null case.
  • Method Details

    • setSeparator

      public void setSeparator(String separator)
    • includeCancelButton

      public void includeCancelButton(boolean b)
    • choose

      public boolean choose(Collection<?> choices, Collection<String> names, Collection<?> values, Collection<String> descriptions, boolean[] selected, boolean[] disabled)
      Allows the user to choose from the supplied list. Items not selected are removed from the list.
      Parameters:
      choices - a collection of objects to choose from
      names - an optional collection of descriptive names
      values - an optional collection of values
      descriptions - an optional collection of descriptions
      selected - an array of initially selected states or null if none selected
      disabled - an array of disabled states (true = disabled) or null if none disabled
      Returns:
      true if OK button was clicked JAVA ONLY and when actionListener field is null
    • setVisible

      public void setVisible(boolean b)
      Overrides:
      setVisible in class Dialog
    • wasCanceled

      public boolean wasCanceled()