Module jEdit

Class Gutter

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, SwingConstants

public class Gutter extends JComponent implements 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.
Version:
$Id: Gutter.java 25033 2020-03-25 23:22:26Z kpouer $
Author:
Mike Dillon and Slava Pestov
See Also:
  • Field Details

  • Constructor Details

    • Gutter

      public Gutter(TextArea textArea)
  • Method Details

    • setFoldPainter

      public void setFoldPainter(FoldPainter painter)
    • paintComponent

      public void paintComponent(Graphics _gfx)
      Overrides:
      paintComponent in class 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 String getToolTipText(MouseEvent evt)
      Returns the tool tip to display at the specified location.
      Overrides:
      getToolTipText in class JComponent
      Parameters:
      evt - The mouse event
    • setBorder

      public void setBorder(int width, Color color1, Color color2, 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(Border border)
      Overrides:
      setBorder in class JComponent
    • setMinLineNumberDigitCount

      public void setMinLineNumberDigitCount(int min)
    • setFont

      public void setFont(Font font)
      Overrides:
      setFont in class JComponent
    • setGutterEnabled

      public void setGutterEnabled(boolean enabled)
    • isSelectionAreaEnabled

      public boolean isSelectionAreaEnabled()
    • setSelectionAreaEnabled

      public void setSelectionAreaEnabled(boolean enabled)
    • setSelectionAreaBackground

      public void setSelectionAreaBackground(Color bgColor)
    • setSelectionAreaWidth

      public void setSelectionAreaWidth(int width)
    • getHighlightedForeground

      public Color getHighlightedForeground()
      Get the foreground color for highlighted line numbers
      Returns:
      The highlight color
    • setHighlightedForeground

      public void setHighlightedForeground(Color highlight)
    • getCurrentLineForeground

      public Color getCurrentLineForeground()
    • setCurrentLineForeground

      public void setCurrentLineForeground(Color highlight)
    • getFoldColor

      public Color getFoldColor()
    • setFoldColor

      public void setFoldColor(Color foldColor)
    • getPreferredSize

      public Dimension getPreferredSize()
      Overrides:
      getPreferredSize in class JComponent
    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class 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 Color getStructureHighlightColor()
      Returns the structure highlight color.
      Since:
      jEdit 4.2pre3
    • setStructureHighlightColor

      public final void setStructureHighlightColor(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)