Schnittstelle TextHandler

Alle Superschnittstellen:
ComponentHandler<String>

public interface TextHandler extends ComponentHandler<String>

A specialized ComponentHandler implementation for text components.

This handler class provides some extended functionality specific for text input components. Examples of this functionality include methods for querying or manipulating the text field's selection or support for clipboard operations. Using this handler interface applications gain more control of text components.

Version:
$Id: TextHandler.java 205 2012-01-29 18:29:57Z oheger $
Autor:
Oliver Heger
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    Clears the selection of the text component.
    void
    Copies the currently selected text to the system clipboard.
    void
    cut()
    Cuts the currently selected text and copies it into the system clipboard.
    Returns the currently selected text.
    int
    Returns the end index of the current selection in the text field.
    int
    Returns the start index of the current selection in the text field.
    boolean
    Returns a flag whether the text component has a non-empty selection.
    void
    Pastes the content of the system clipboard into this text component.
    void
    Replaces the text currently selected by the specified string.
    void
    select(int start, int end)
    Sets the selection of the text field.
    void
    Selects all text contained in the text component.

    Von Schnittstelle geerbte Methoden net.sf.jguiraffe.gui.forms.ComponentHandler

    getComponent, getData, getOuterComponent, getType, isEnabled, setData, setEnabled
  • Methodendetails

    • hasSelection

      boolean hasSelection()
      Returns a flag whether the text component has a non-empty selection. If this method returns true, other methods can be called that operate on the selection.
      Gibt zurück:
      a flag whether a selection exists
    • getSelectionStart

      int getSelectionStart()
      Returns the start index of the current selection in the text field. The value returned by this method is only meaningful if hasSelection() returns true.
      Gibt zurück:
      the start index of the selection
    • getSelectionEnd

      int getSelectionEnd()
      Returns the end index of the current selection in the text field. The value returned by this method is only meaningful if hasSelection() returns true.
      Gibt zurück:
      the end index of the selection
    • select

      void select(int start, int end)
      Sets the selection of the text field. The parameters passed to this method are the start index and the end index of the selection. Indices are 0-based and are related to the characters stored in the text field.
      Parameter:
      start - the start index of the selection
      end - the end index of the selection
    • selectAll

      void selectAll()
      Selects all text contained in the text component.
    • clearSelection

      void clearSelection()
      Clears the selection of the text component. This does not affect the text stored in the component. Only the selection is reset.
    • getSelectedText

      String getSelectedText()
      Returns the currently selected text. The result of this method is only meaningful if a selection exists, i.e. if hasSelection() returns true.
      Gibt zurück:
      the selected text
    • replaceSelectedText

      void replaceSelectedText(String text)
      Replaces the text currently selected by the specified string. If no selection exists, the specified text is inserted at the current caret position. If there is a selection, but the replacement text is null or empty, the selected text is removed.
      Parameter:
      text - the replacement text
    • copy

      void copy()
      Copies the currently selected text to the system clipboard. This is the standard edit copy action.
    • cut

      void cut()
      Cuts the currently selected text and copies it into the system clipboard. This is the standard edit cut action.
    • paste

      void paste()
      Pastes the content of the system clipboard into this text component. This is the standard edit paste action.