Class SelectTextField

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, SelectCharactersListener

public class SelectTextField extends JPanel implements SelectCharactersListener
A component for accepting a text string, but with the additional capability of choosing from the complete list of characters available in the current font. The font details are shown in a popup window that is initialised using a button shown against the text entry area.
Since:
$Date$, 06-NOV-2000
Version:
$Id$
Author:
Peter W. Draper
See Also:
  • Field Details

    • textField

      protected JTextField textField
      The text entry field.
    • charButton

      protected JButton charButton
      Button to initiate selecting special characters.
    • charChooser

      protected SelectCharacters charChooser
      The special character chooser.
    • listeners

      protected EventListenerList listeners
  • Constructor Details

    • SelectTextField

      public SelectTextField()
      Create an instance.
    • SelectTextField

      public SelectTextField(String text)
      Create an instance with initial text field.
      Parameters:
      text - default text for the text field.
    • SelectTextField

      public SelectTextField(String text, SelectCharacters charChooser)
      Create an instance with initial text field and using the pre-configured instance of SelectCharacters.
      Parameters:
      text - default text for the text field.
  • Method Details

    • initUI

      protected void initUI()
      Initialise the user interface.
    • chooseChars

      protected void chooseChars()
      Choose a special character phrase to append.
    • newCharacters

      public void newCharacters(SelectCharactersEvent e)
      Accept new characters.
      Specified by:
      newCharacters in interface SelectCharactersListener
    • setText

      public void setText(String text)
      Set the displayed text.
    • insertText

      public void insertText(String text)
      Insert new text, either at the end or at the insertion point.
    • getText

      public String getText()
      Get the displayed text.
    • setTextFont

      public void setTextFont(Font font)
      Set the text font.
    • getTextFont

      public Font getTextFont()
      Get the text font.
    • setTextColour

      public void setTextColour(Color colour)
      Set the text colour.
    • getTextColour

      public Color getTextColour()
      Get the text colour.
    • getDocument

      public Document getDocument()
      Get the document model used by the JTextField.
    • setToolTipText

      public void setToolTipText(String tip)
      Set the tooltip for the text component.
      Overrides:
      setToolTipText in class JComponent
    • setColumns

      public void setColumns(int columns)
      Set the number of columns displayed by the JTextField.
    • addActionListener

      public void addActionListener(ActionListener l)
      Registers a listener who wants to be informed about changes to the character string.
      Parameters:
      l - the ActionListener
    • removeActionListener

      public void removeActionListener(ActionListener l)
    • fireAction

      protected void fireAction(ActionEvent e)
      Send action event to all listeners.