Class BaseTextPaneWithWordWrap

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, TextPaneComponent

public class BaseTextPaneWithWordWrap extends BasePanel implements TextPaneComponent
A panel containing a BaseTextPane, to allow wordwrap functionality.
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

    • m_TextPane

      protected BaseTextPane m_TextPane
      the wrapped text pane.
    • m_PanelWrapper

      protected JPanel m_PanelWrapper
      the wrapper panel.
    • m_ScrollPane

      protected BaseScrollPane m_ScrollPane
      the scroll pane.
    • m_WordWrap

      protected boolean m_WordWrap
      whether wordwrap is on.
  • Constructor Details

    • BaseTextPaneWithWordWrap

      public BaseTextPaneWithWordWrap()
  • Method Details

    • initialize

      protected void initialize()
      Initializes the members.
      Overrides:
      initialize in class BasePanel
    • initGUI

      protected void initGUI()
      For initializing the GUI.
      Overrides:
      initGUI in class BasePanel
    • getTextPane

      public BaseTextPane getTextPane()
      Returns the underlying BaseTextPane.
      Returns:
      the pane
    • setText

      public void setText(String value)
      Sets the text to display.
      Specified by:
      setText in interface TextPaneComponent
      Parameters:
      value - the text
    • getText

      public String getText()
      Returns the text to display.
      Specified by:
      getText in interface TextPaneComponent
      Returns:
      the text
    • getSelectedText

      public String getSelectedText()
      Returns the underlying text.
      Specified by:
      getSelectedText in interface TextPaneComponent
      Returns:
      the underlying text
    • setEditable

      public void setEditable(boolean value)
      Sets whether the text pane is editable or not.
      Specified by:
      setEditable in interface TextPaneComponent
      Parameters:
      value - if true the text pane is editable
    • isEditable

      public boolean isEditable()
      Returns whether the text pane is editable or not.
      Specified by:
      isEditable in interface TextPaneComponent
      Returns:
      true if the text pane is editable
    • getDocument

      public Document getDocument()
      Returns the underlying document.
      Specified by:
      getDocument in interface TextPaneComponent
      Returns:
      the document
    • setWordWrap

      public void setWordWrap(boolean value)
      Sets the wordwrap state.
      Parameters:
      value - true if to turn wordwrap on
    • getWordWrap

      public boolean getWordWrap()
      Returns whether wordwrap is on.
      Returns:
      true if wordwrap is on
    • append

      public void append(String text)
      Appends the text at the end.
      Parameters:
      text - the text to append
    • append

      public void append(String text, AttributeSet a)
      Appends the text at the end.
      Parameters:
      text - the text to append
      a - the attribute set, null if to use current
    • setCaretPosition

      public void setCaretPosition(int value)
      Sets the position of the cursor.
      Specified by:
      setCaretPosition in interface TextPaneComponent
      Parameters:
      value - the position
    • getCaretPosition

      public int getCaretPosition()
      Returns the current position of the cursor.
      Specified by:
      getCaretPosition in interface TextPaneComponent
      Returns:
      the cursor position
    • setCaretPositionLast

      public void setCaretPositionLast()
      Sets the position of the cursor at the end.
      Specified by:
      setCaretPositionLast in interface TextPaneComponent