TextAreaExtension (jEdit API Documentation)
Date: 2018-04-10

org.gjt.sp.jedit.textarea

## Class TextAreaExtension

- java.lang.Object
- - org.gjt.sp.jedit.textarea.TextAreaExtension

- Direct Known Subclasses:
    PageBreakExtension, StructureMatcher.Highlight

      public abstract class TextAreaExtension
      extends java.lang.Object

  Subclasses of this class can perform custom painting and tool tip handling in the text area and gutter.
  Since:
    jEdit 4.0pre4
  See Also:
    `TextAreaPainter.addExtension(TextAreaExtension)`, `TextAreaPainter.removeExtension(TextAreaExtension)`, `Gutter.addExtension(TextAreaExtension)`, `Gutter.removeExtension(TextAreaExtension)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextAreaExtension()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getToolTipText(int x, int y)` Called by the text area when the mouse hovers over the location specified in the mouse event.
    `void` | `paintInvalidLine(java.awt.Graphics2D gfx, int screenLine, int y)` Called by the text area when the extension is to paint a screen line which is not part of the buffer.
    `void` | `paintScreenLineRange(java.awt.Graphics2D gfx, int firstLine, int lastLine, int[] physicalLines, int[] start, int[] end, int y, int lineHeight)` Paints a range of screen lines.
    `void` | `paintValidLine(java.awt.Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y)` Called by the text area when the extension is to paint a screen line which has an associated physical line number in the buffer.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TextAreaExtension

          public TextAreaExtension()

  - ### Method Detail

    - #### paintScreenLineRange

          public void paintScreenLineRange(java.awt.Graphics2D gfx,
                                           int firstLine,
                                           int lastLine,
                                           int[] physicalLines,
                                           int[] start,
                                           int[] end,
                                           int y,
                                           int lineHeight)

      Paints a range of screen lines. The default implementation calls `paintValidLine(Graphics2D,int,int,int,int,int)` and `paintInvalidLine(Graphics2D,int,int)`.
      Parameters:
        `gfx` - A graphics context
        `firstLine` - The first screen line
        `lastLine` - The last screen line
        `physicalLines` - The list of physical line numbers. Entries are -1 if the screen line is out of range.
        `start` - An array of screen line start offsets.
        `end` - An array of screen line end offsets
        `y` - The y co-ordinate
        `lineHeight` - The line height
      Since:
        jEdit 4.2pre2

    - #### paintValidLine

          public void paintValidLine(java.awt.Graphics2D gfx,
                                     int screenLine,
                                     int physicalLine,
                                     int start,
                                     int end,
                                     int y)

      Called by the text area when the extension is to paint a screen line which has an associated physical line number in the buffer. Note that since one physical line may consist of several screen lines due to soft wrap, the start and end offsets of the screen line are passed in as well.
      Parameters:
        `gfx` - The graphics context
        `screenLine` - The screen line number
        `physicalLine` - The physical line number
        `start` - The offset where the screen line begins, from the start of the buffer
        `end` - The offset where the screen line ends, from the start of the buffer
        `y` - The y co-ordinate of the top of the line's bounding box
      Since:
        jEdit 4.0pre4

    - #### paintInvalidLine

          public void paintInvalidLine(java.awt.Graphics2D gfx,
                                       int screenLine,
                                       int y)

      Called by the text area when the extension is to paint a screen line which is not part of the buffer. This can happen if the buffer is shorter than the height of the text area, for example.
      Parameters:
        `gfx` - The graphics context
        `screenLine` - The screen line number
        `y` - The y co-ordinate of the top of the line's bounding box
      Since:
        jEdit 4.0pre4

    - #### getToolTipText

          public java.lang.String getToolTipText(int x,
                                                 int y)

      Called by the text area when the mouse hovers over the location specified in the mouse event.
      Parameters:
        `x` - The x co-ordinate
        `y` - The y co-ordinate
      Since:
        jEdit 4.0pre4