org.gjt.sp.jedit.textarea

## Class Gutter

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - org.gjt.sp.jedit.textarea.Gutter

- All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

      public class Gutter
      extends javax.swing.JComponent
      implements javax.swing.SwingConstants

  The gutter is the component that displays folding indicators and line numbers to the left of the text area. The only methods in this class that should be called by plugins are those for adding and removing text area extensions.
  See Also:
    `addExtension(TextAreaExtension)`, `addExtension(int,TextAreaExtension)`, `removeExtension(TextAreaExtension)`, `TextAreaExtension`, `TextArea`, Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JComponent

      `javax.swing.JComponent.AccessibleJComponent`

    - ### Nested classes/interfaces inherited from class java.awt.Container

      `java.awt.Container.AccessibleAWTContainer`

    - ### Nested classes/interfaces inherited from class java.awt.Component

      `java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_FOLD_PAINTER_SERVICE`
    `static int` | `DEFAULT_LAYER` Default extension layer.
    `static java.lang.String` | `FOLD_PAINTER_PROPERTY` Fold painter service.
    `static java.lang.String` | `FOLD_PAINTER_SERVICE`
    `static int` | `HIGHEST_LAYER` Highest possible layer.
    `static int` | `LOWEST_LAYER` The lowest possible layer.

    - ### Fields inherited from class javax.swing.JComponent

      `accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

    - ### Fields inherited from class java.awt.Component

      `BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

    - ### Fields inherited from interface javax.swing.SwingConstants

      `BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST`

    - ### Fields inherited from interface java.awt.image.ImageObserver

      `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Gutter(TextArea textArea)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addExtension(int layer, TextAreaExtension extension)` Adds a text area extension, which can perform custom painting and tool tip handling.
    `void` | `addExtension(TextAreaExtension extension)` Adds a text area extension, which can perform custom painting and tool tip handling.
    `java.awt.Color` | `getCurrentLineForeground()`
    `TextAreaExtension[]` | `getExtensions()` Returns an array of registered text area extensions.
    `java.awt.Color` | `getFoldColor()`
    `java.awt.Color` | `getHighlightedForeground()` Get the foreground color for highlighted line numbers
    `int` | `getHighlightInterval()` Sets the number of lines between highlighted line numbers.
    `int` | `getLineNumberAlignment()` Identifies whether the horizontal alignment of the line numbers.
    `java.awt.Dimension` | `getMinimumSize()`
    `java.awt.Dimension` | `getPreferredSize()`
    `GutterPopupHandler` | `getSelectionPopupHandler()`
    `java.awt.Color` | `getStructureHighlightColor()` Returns the structure highlight color.
    `java.lang.String` | `getToolTipText(java.awt.event.MouseEvent evt)` Returns the tool tip to display at the specified location.
    `boolean` | `isCurrentLineHighlightEnabled()`
    `boolean` | `isExpanded()` Identifies whether the gutter is collapsed or expanded.
    `boolean` | `isSelectionAreaEnabled()`
    `boolean` | `isStructureHighlightEnabled()` Returns true if structure highlighting is enabled, false otherwise.
    `void` | `paintComponent(java.awt.Graphics _gfx)`
    `void` | `removeExtension(TextAreaExtension extension)` Removes a text area extension.
    `void` | `setBorder(javax.swing.border.Border border)`
    `void` | `setBorder(int width, java.awt.Color color1, java.awt.Color color2, java.awt.Color color3)` Convenience method for setting a default matte border on the right with the specified border width and color
    `void` | `setCurrentLineForeground(java.awt.Color highlight)`
    `void` | `setCurrentLineHighlightEnabled(boolean enabled)`
    `void` | `setExpanded(boolean expanded)` Sets whether the gutter is collapsed or expanded and force the text area to update its layout if there is a change.
    `void` | `setFoldColor(java.awt.Color foldColor)`
    `void` | `setFoldPainter(FoldPainter painter)`
    `void` | `setFont(java.awt.Font font)`
    `void` | `setGutterEnabled(boolean enabled)`
    `void` | `setHighlightedForeground(java.awt.Color highlight)`
    `void` | `setHighlightInterval(int interval)` Sets the number of lines between highlighted line numbers.
    `void` | `setLineNumberAlignment(int alignment)` Sets the horizontal alignment of the line numbers.
    `void` | `setMinLineNumberDigitCount(int min)`
    `void` | `setMouseActionsProvider(MouseActionsProvider mouseActionsProvider)`
    `void` | `setSelectionAreaBackground(java.awt.Color bgColor)`
    `void` | `setSelectionAreaEnabled(boolean enabled)`
    `void` | `setSelectionAreaWidth(int width)`
    `void` | `setSelectionPopupHandler(GutterPopupHandler handler)`
    `void` | `setStructureHighlightColor(java.awt.Color structureHighlightColor)` Sets the structure highlight color.
    `void` | `setStructureHighlightEnabled(boolean structureHighlight)` Enables or disables structure highlighting.
    `void` | `toggleExpanded()` Toggles whether the gutter is collapsed or expanded.
    `void` | `updateBorder()` Sets the border differently if the text area has focus or not.

    - ### Methods inherited from class javax.swing.JComponent

      `addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI`

    - ### Methods inherited from class java.awt.Container

      `add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree`

    - ### Methods inherited from class java.awt.Component

      `action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

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

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

- - ### Field Detail

    - #### LOWEST_LAYER

          public static final int LOWEST_LAYER

      The lowest possible layer.
      Since:
        jEdit 4.0pre4
      See Also:
        `addExtension(int,TextAreaExtension)`, Constant Field Values

    - #### DEFAULT_LAYER

          public static final int DEFAULT_LAYER

      Default extension layer. This is above the wrap guide but below the bracket highlight.
      Since:
        jEdit 4.0pre4
      See Also:
        Constant Field Values

    - #### HIGHEST_LAYER

          public static final int HIGHEST_LAYER

      Highest possible layer.
      Since:
        jEdit 4.0pre4
      See Also:
        Constant Field Values

    - #### FOLD_PAINTER_PROPERTY

          public static final java.lang.String FOLD_PAINTER_PROPERTY

      Fold painter service.
      Since:
        jEdit 4.3pre16
      See Also:
        Constant Field Values

    - #### FOLD_PAINTER_SERVICE

          public static final java.lang.String FOLD_PAINTER_SERVICE

      See Also:
        Constant Field Values

    - #### DEFAULT_FOLD_PAINTER_SERVICE

          public static final java.lang.String DEFAULT_FOLD_PAINTER_SERVICE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Gutter

          public Gutter(TextArea textArea)

  - ### Method Detail

    - #### setFoldPainter

          public void setFoldPainter(FoldPainter painter)

    - #### paintComponent

          public void paintComponent(java.awt.Graphics _gfx)

      Overrides:
        `paintComponent` in class `javax.swing.JComponent`

    - #### addExtension

          public void addExtension(TextAreaExtension extension)

      Adds a text area extension, which can perform custom painting and tool tip handling.
      Parameters:
        `extension` - The extension
      Since:
        jEdit 4.0pre4

    - #### addExtension

          public void addExtension(int layer,
                          TextAreaExtension extension)

      Adds a text area extension, which can perform custom painting and tool tip handling.
      Parameters:
        `layer` - The layer to add the extension to. Note that more than extension can share the same layer.
        `extension` - The extension
      Since:
        jEdit 4.0pre4

    - #### removeExtension

          public void removeExtension(TextAreaExtension extension)

      Removes a text area extension. It will no longer be asked to perform custom painting and tool tip handling.
      Parameters:
        `extension` - The extension
      Since:
        jEdit 4.0pre4

    - #### getExtensions

          public TextAreaExtension[] getExtensions()

      Returns an array of registered text area extensions. Useful for debugging purposes.
      Since:
        jEdit 4.1pre5

    - #### getToolTipText

          public java.lang.String getToolTipText(java.awt.event.MouseEvent evt)

      Returns the tool tip to display at the specified location.
      Overrides:
        `getToolTipText` in class `javax.swing.JComponent`
      Parameters:
        `evt` - The mouse event

    - #### setBorder

          public void setBorder(int width,
                       java.awt.Color color1,
                       java.awt.Color color2,
                       java.awt.Color color3)

      Convenience method for setting a default matte border on the right with the specified border width and color
      Parameters:
        `width` - The border width (in pixels)
        `color1` - The focused border color
        `color2` - The unfocused border color
        `color3` - The gutter/text area gap color

    - #### updateBorder

          public void updateBorder()

      Sets the border differently if the text area has focus or not.

    - #### setBorder

          public void setBorder(javax.swing.border.Border border)

      Overrides:
        `setBorder` in class `javax.swing.JComponent`

    - #### setMinLineNumberDigitCount

          public void setMinLineNumberDigitCount(int min)

    - #### setFont

          public void setFont(java.awt.Font font)

      Overrides:
        `setFont` in class `javax.swing.JComponent`

    - #### setGutterEnabled

          public void setGutterEnabled(boolean enabled)

    - #### isSelectionAreaEnabled

          public boolean isSelectionAreaEnabled()

    - #### setSelectionAreaEnabled

          public void setSelectionAreaEnabled(boolean enabled)

    - #### setSelectionAreaBackground

          public void setSelectionAreaBackground(java.awt.Color bgColor)

    - #### setSelectionAreaWidth

          public void setSelectionAreaWidth(int width)

    - #### getHighlightedForeground

          public java.awt.Color getHighlightedForeground()

      Get the foreground color for highlighted line numbers
      Returns:
        The highlight color

    - #### setHighlightedForeground

          public void setHighlightedForeground(java.awt.Color highlight)

    - #### getCurrentLineForeground

          public java.awt.Color getCurrentLineForeground()

    - #### setCurrentLineForeground

          public void setCurrentLineForeground(java.awt.Color highlight)

    - #### getFoldColor

          public java.awt.Color getFoldColor()

    - #### setFoldColor

          public void setFoldColor(java.awt.Color foldColor)

    - #### getPreferredSize

          public java.awt.Dimension getPreferredSize()

      Overrides:
        `getPreferredSize` in class `javax.swing.JComponent`

    - #### getMinimumSize

          public java.awt.Dimension getMinimumSize()

      Overrides:
        `getMinimumSize` in class `javax.swing.JComponent`

    - #### getLineNumberAlignment

          public int getLineNumberAlignment()

      Identifies whether the horizontal alignment of the line numbers.
      Returns:
        Gutter.RIGHT, Gutter.CENTER, Gutter.LEFT

    - #### setLineNumberAlignment

          public void setLineNumberAlignment(int alignment)

      Sets the horizontal alignment of the line numbers.
      Parameters:
        `alignment` - Gutter.RIGHT, Gutter.CENTER, Gutter.LEFT

    - #### isExpanded

          public boolean isExpanded()

      Identifies whether the gutter is collapsed or expanded.
      Returns:
        true if the gutter is expanded, false if it is collapsed

    - #### setExpanded

          public void setExpanded(boolean expanded)

      Sets whether the gutter is collapsed or expanded and force the text area to update its layout if there is a change.
      Parameters:
        `expanded` - true if the gutter is expanded, false if it is collapsed

    - #### toggleExpanded

          public void toggleExpanded()

      Toggles whether the gutter is collapsed or expanded.

    - #### getHighlightInterval

          public int getHighlightInterval()

      Sets the number of lines between highlighted line numbers.
      Returns:
        The number of lines between highlighted line numbers or zero if highlighting is disabled

    - #### setHighlightInterval

          public void setHighlightInterval(int interval)

      Sets the number of lines between highlighted line numbers. Any value less than or equal to one will result in highlighting being disabled.
      Parameters:
        `interval` - The number of lines between highlighted line numbers

    - #### isCurrentLineHighlightEnabled

          public boolean isCurrentLineHighlightEnabled()

    - #### setCurrentLineHighlightEnabled

          public void setCurrentLineHighlightEnabled(boolean enabled)

    - #### getStructureHighlightColor

          public final java.awt.Color getStructureHighlightColor()

      Returns the structure highlight color.
      Since:
        jEdit 4.2pre3

    - #### setStructureHighlightColor

          public final void setStructureHighlightColor(java.awt.Color structureHighlightColor)

      Sets the structure highlight color.
      Parameters:
        `structureHighlightColor` - The structure highlight color
      Since:
        jEdit 4.2pre3

    - #### isStructureHighlightEnabled

          public final boolean isStructureHighlightEnabled()

      Returns true if structure highlighting is enabled, false otherwise.
      Since:
        jEdit 4.2pre3

    - #### setStructureHighlightEnabled

          public final void setStructureHighlightEnabled(boolean structureHighlight)

      Enables or disables structure highlighting.
      Parameters:
        `structureHighlight` - True if structure highlighting should be enabled, false otherwise
      Since:
        jEdit 4.2pre3

    - #### setSelectionPopupHandler

          public void setSelectionPopupHandler(GutterPopupHandler handler)

    - #### getSelectionPopupHandler

          public GutterPopupHandler getSelectionPopupHandler()

    - #### setMouseActionsProvider

          public void setMouseActionsProvider(MouseActionsProvider mouseActionsProvider)