Class ExampleSelectField

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ExampleSelectField extends JPanel
Text entry component with some additional features. Some example text may be provided, and this will be displayed inside the component until it's used. Items chosen are kept as options that can be easily selected on subsequent occasions. This is currently implemented as an editable JComboBox.
Since:
14 Jul 2015
Author:
Mark Taylor
See Also:
  • Constructor Details

    • ExampleSelectField

      public ExampleSelectField(String exampleText)
      Constructor.
      Parameters:
      exampleText - text for display before use; may be null
  • Method Details

    • getText

      public String getText()
      Returns the currently entered text.
      Returns:
      text
    • setText

      public void setText(String txt)
      Programmatically sets the currently entered text.
      Parameters:
      txt - text
    • chooseText

      public void chooseText(String txt)
      Marks given text as a chosen value for this component. This method should usually be called if the selection has been used in some way. The text will then be available for subsequent re-selection.
      Parameters:
      txt - chosen text
    • addActionListener

      public void addActionListener(ActionListener l)
      Adds an action listener.
      Parameters:
      l - listener to add
    • removeActionListener

      public void removeActionListener(ActionListener l)
      Removes an actino listener.
      Parameters:
      l - previously-added listener