Class HighlightedDocument

All Implemented Interfaces:
Serializable, Document, StyledDocument

public class HighlightedDocument extends DefaultStyledDocument
A demonstration text editor that uses syntax highlighting.
See Also:
  • Field Details

    • SQL_STYLE

      public static final Object SQL_STYLE
    • JAVASCRIPT_STYLE

      public static final Object JAVASCRIPT_STYLE
    • GRAYED_OUT_STYLE

      public static final Object GRAYED_OUT_STYLE
  • Constructor Details

    • HighlightedDocument

      public HighlightedDocument(Object l)
      Create a new Demo
  • Method Details

    • colorAll

      public void colorAll()
      Color or recolor the entire document
    • color

      public void color(int position, int adjustment)
      Color a section of the document. The actual coloring will start somewhere before the requested position and continue as long as needed.
      Parameters:
      position - the starting point for the coloring.
      adjustment - amount of text inserted or removed at the starting point.
    • setGlobalStyle

      public void setGlobalStyle(AttributeSet value)
    • setHighlightStyle

      public void setHighlightStyle(Object valueSource)
    • insertString

      public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
      Specified by:
      insertString in interface Document
      Overrides:
      insertString in class AbstractDocument
      Throws:
      BadLocationException
    • remove

      public void remove(int offs, int len) throws BadLocationException
      Specified by:
      remove in interface Document
      Overrides:
      remove in class AbstractDocument
      Throws:
      BadLocationException
    • stopColorer

      public void stopColorer()
      Deactivate the colorer to end the backend thread.