Class Gutter

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

    public class Gutter
    extends javax.swing.JPanel
    The gutter is the component on the left-hand side of the text area that displays optional information such as line numbers, fold regions, and icons (for bookmarks, debugging breakpoints, error markers, etc.).

    Icons can be added on a per-line basis to visually mark syntax errors, lines with breakpoints set on them, etc. To add icons to the gutter, you must first call RTextScrollPane.setIconRowHeaderEnabled(boolean) on the parent scroll pane, to make the icon area visible. Then, you can add icons that track either lines in the document, or offsets, via addLineTrackingIcon(int, Icon) and addOffsetTrackingIcon(int, Icon), respectively. To remove an icon you've added, use removeTrackingIcon(GutterIconInfo).

    In addition to support for arbitrary per-line icons, this component also has built-in support for displaying icons representing "bookmarks;" that is, lines a user can cycle through via F2 and Shift+F2. Bookmarked lines are toggled via Ctrl+F2. In order to enable bookmarking, you must first assign an icon to represent a bookmarked line, then actually enable the feature:

     Gutter gutter = scrollPane.getGutter();
     gutter.setBookmarkIcon(new ImageIcon("bookmark.png"));
     gutter.setBookmarkingEnabled(true);
     
    Version:
    1.0
    See Also:
    GutterIconInfo, Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Gutter.GutterBorder
      The border used by the gutter.
      private class  Gutter.TextAreaListener
      Listens for the text area resizing.
      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • 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 Description
      private boolean armed
      Whether this gutter, or any child components, are armed.
      private java.awt.Color currentLineNumberColor
      The color used to render the currently active line's line number.
      static java.awt.Color DEFAULT_ACTIVE_LINE_RANGE_COLOR
      The color used to highlight active line ranges if none is specified.
      private FoldIndicator foldIndicator
      Shows lines that are code-foldable.
      private IconRowHeader iconArea
      Renders bookmark icons, breakpoints, error icons, etc.
      private boolean iconRowHeaderInheritsGutterBackground
      Whether the icon area inherits the gutter background (as opposed to painting with its own, default "panel" color).
      private java.awt.Color lineNumberColor
      The color used to render line numbers.
      private java.awt.Font lineNumberFont
      The font used to render line numbers.
      private LineNumberFormatter lineNumberFormatter
      Formats line numbers into a string to be displayed.
      private int lineNumberingStartIndex
      The starting index for line numbers in the gutter.
      private LineNumberList lineNumberList
      Renders line numbers.
      private Gutter.TextAreaListener listener
      Listens for events in our text area.
      private int spacingBetweenLineNumbersAndFoldIndicator
      Optional additional spacing between the line number component and the fold indicator component.
      private RTextArea textArea
      The text area.
      • Fields inherited from class javax.swing.JComponent

        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

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      Gutter​(RTextArea textArea)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GutterIconInfo addLineTrackingIcon​(int line, javax.swing.Icon icon)
      Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers.
      GutterIconInfo addLineTrackingIcon​(int line, javax.swing.Icon icon, java.lang.String tip)
      Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers.
      GutterIconInfo addOffsetTrackingIcon​(int offs, javax.swing.Icon icon)
      Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers.
      GutterIconInfo addOffsetTrackingIcon​(int offs, javax.swing.Icon icon, java.lang.String tip)
      Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers.
      private void clearActiveLineRange()
      Clears the active line range.
      java.awt.Color getActiveLineRangeColor()
      Returns the color used to paint the active line range, if any.
      java.awt.Color getArmedFoldBackground()
      Returns the background color used by the (default) fold icons when they are armed.
      javax.swing.Icon getBookmarkIcon()
      Returns the icon to use for bookmarks.
      GutterIconInfo[] getBookmarks()
      Returns the bookmarks known to this gutter.
      java.awt.Color getBorderColor()
      Returns the color of the "border" line.
      java.awt.Color getCurrentLineNumberColor()
      The color used to render the currently active line's line number.
      ExpandedFoldRenderStrategy getExpandedFoldRenderStrategy()
      Returns the strategy to use for rendering expanded folds.
      java.awt.Color getFoldBackground()
      Returns the background color used by the (default) fold icons.
      java.awt.Color getFoldIndicatorArmedForeground()
      Returns the foreground color of the fold indicator for armed folds.
      java.awt.Color getFoldIndicatorForeground()
      Returns the foreground color of the fold indicator.
      boolean getIconRowHeaderInheritsGutterBackground()
      Returns whether the icon area inherits the gutter background (as opposed to painting with its own, default "panel" color, which is the default).
      java.awt.Color getLineNumberColor()
      Returns the color to use to paint line numbers.
      java.awt.Font getLineNumberFont()
      Returns the font used for line numbers.
      LineNumberFormatter getLineNumberFormatter()
      Returns the line number formatter.
      int getLineNumberingStartIndex()
      Returns the starting line's line number.
      boolean getLineNumbersEnabled()
      Returns true if the line numbers are enabled and visible.
      boolean getShowCollapsedRegionToolTips()
      Returns whether tool tips are displayed showing the contents of collapsed fold regions when the mouse hovers over a +/- icon.
      int getSpacingBetweenLineNumbersAndFoldIndicator()
      Returns the additional spacing between the line number list and fold indicator.
      GutterIconInfo[] getTrackingIcons​(java.awt.Point p)
      Returns the tracking icons at the specified view position.
      boolean isArmed()
      Returns whether this gutter is "armed", that is, any child components are armed.
      boolean isBookmarkingEnabled()
      Returns whether bookmarking is enabled.
      boolean isFoldIndicatorEnabled()
      Returns whether the fold indicator is enabled.
      boolean isIconRowHeaderEnabled()
      Returns whether the icon row header is enabled.
      void removeAllTrackingIcons()
      Removes all tracking icons.
      void removeTrackingIcon​(GutterIconInfo tag)
      Removes the specified tracking icon.
      private void setActiveLineRange​(int startLine, int endLine)
      Highlights a range of lines in the icon area.
      void setActiveLineRangeColor​(java.awt.Color color)
      Sets the color to use to render active line ranges.
      (package private) void setArmed​(boolean armed)
      Toggles whether this gutter is "armed", that is, any child components are armed.
      void setArmedFoldBackground​(java.awt.Color bg)
      Sets the background color used by the (default) fold icons when they are armed.
      void setBookmarkIcon​(javax.swing.Icon icon)
      Sets the icon to use for bookmarks.
      void setBookmarkingEnabled​(boolean enabled)
      Sets whether bookmarking is enabled.
      void setBorder​(javax.swing.border.Border border)  
      void setBorderColor​(java.awt.Color color)
      Sets the color for the "border" line.
      void setComponentOrientation​(java.awt.ComponentOrientation o)  
      void setCurrentLineNumberColor​(java.awt.Color color)
      Sets the color used to render the currently active line's line number.
      void setExpandedFoldRenderStrategy​(ExpandedFoldRenderStrategy strategy)
      Sets the strategy to use for rendering expanded folds.
      void setFoldBackground​(java.awt.Color bg)
      Sets the background color used by the (default) fold icons.
      void setFoldIcons​(FoldIndicatorIcon collapsedIcon, FoldIndicatorIcon expandedIcon)
      Sets the icons to use to represent collapsed and expanded folds.
      void setFoldIndicatorArmedForeground​(java.awt.Color fg)
      Sets the foreground color used by the fold indicator for armed folds.
      void setFoldIndicatorEnabled​(boolean enabled)
      Toggles whether the fold indicator is enabled.
      void setFoldIndicatorForeground​(java.awt.Color fg)
      Sets the foreground color used by the fold indicator.
      void setFoldIndicatorStyle​(FoldIndicatorStyle style)
      Toggles the presentation of the fold region of this component.
      void setIconRowHeaderEnabled​(boolean enabled)
      Toggles whether the icon row header (used for breakpoints, bookmarks, etc.) is enabled.
      void setIconRowHeaderInheritsGutterBackground​(boolean inherits)
      Sets whether the icon area inherits the gutter background (as opposed to painting with its own, default "panel" color, which is the default).
      void setLineNumberColor​(java.awt.Color color)
      Sets the color to use to paint line numbers.
      void setLineNumberFont​(java.awt.Font font)
      Sets the font used for line numbers.
      void setLineNumberFormatter​(LineNumberFormatter formatter)
      Sets a custom line number formatter.
      void setLineNumberingStartIndex​(int index)
      Sets the starting line's line number.
      void setLineNumbersEnabled​(boolean enabled)
      Toggles whether line numbers are visible.
      void setShowCollapsedRegionToolTips​(boolean show)
      Toggles whether tool tips should be displayed showing the contents of collapsed fold regions when the mouse hovers over a +/- icon.
      void setSpacingBetweenLineNumbersAndFoldIndicator​(int spacing)
      Sets additional spacing between the line number list and fold indicator.
      void setTextArea​(RTextArea textArea)
      Sets the text area being displayed.
      boolean toggleBookmark​(int line)
      Programmatically toggles whether there is a bookmark for the specified line.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, 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

      • DEFAULT_ACTIVE_LINE_RANGE_COLOR

        public static final java.awt.Color DEFAULT_ACTIVE_LINE_RANGE_COLOR
        The color used to highlight active line ranges if none is specified.
      • textArea

        private RTextArea textArea
        The text area.
      • lineNumberList

        private LineNumberList lineNumberList
        Renders line numbers.
      • lineNumberColor

        private java.awt.Color lineNumberColor
        The color used to render line numbers.
      • currentLineNumberColor

        private java.awt.Color currentLineNumberColor
        The color used to render the currently active line's line number. If this is null, lineNumberColor is used.
      • lineNumberingStartIndex

        private int lineNumberingStartIndex
        The starting index for line numbers in the gutter.
      • lineNumberFormatter

        private LineNumberFormatter lineNumberFormatter
        Formats line numbers into a string to be displayed.
      • lineNumberFont

        private java.awt.Font lineNumberFont
        The font used to render line numbers.
      • iconArea

        private IconRowHeader iconArea
        Renders bookmark icons, breakpoints, error icons, etc.
      • iconRowHeaderInheritsGutterBackground

        private boolean iconRowHeaderInheritsGutterBackground
        Whether the icon area inherits the gutter background (as opposed to painting with its own, default "panel" color).
      • spacingBetweenLineNumbersAndFoldIndicator

        private int spacingBetweenLineNumbersAndFoldIndicator
        Optional additional spacing between the line number component and the fold indicator component.
      • foldIndicator

        private FoldIndicator foldIndicator
        Shows lines that are code-foldable.
      • armed

        private boolean armed
        Whether this gutter, or any child components, are armed. Used internally for e.g. the fold indicator's appearance.
    • Constructor Detail

      • Gutter

        public Gutter​(RTextArea textArea)
        Constructor.
        Parameters:
        textArea - The parent text area.
    • Method Detail

      • addLineTrackingIcon

        public GutterIconInfo addLineTrackingIcon​(int line,
                                                  javax.swing.Icon icon)
                                           throws javax.swing.text.BadLocationException
        Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. This is useful for marking things such as source code errors.
        Parameters:
        line - The line to track (zero-based).
        icon - The icon to display. This should be small (say 16x16).
        Returns:
        A tag for this icon. This can later be used in a call to removeTrackingIcon(GutterIconInfo) to remove this icon.
        Throws:
        javax.swing.text.BadLocationException - If offs is an invalid offset into the text area.
        See Also:
        addLineTrackingIcon(int, Icon, String), addOffsetTrackingIcon(int, Icon), removeTrackingIcon(GutterIconInfo)
      • addLineTrackingIcon

        public GutterIconInfo addLineTrackingIcon​(int line,
                                                  javax.swing.Icon icon,
                                                  java.lang.String tip)
                                           throws javax.swing.text.BadLocationException
        Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. This is useful for marking things such as source code errors.
        Parameters:
        line - The line to track (zero-based).
        icon - The icon to display. This should be small (say 16x16).
        tip - An optional tool tip for the icon.
        Returns:
        A tag for this icon. This can later be used in a call to removeTrackingIcon(GutterIconInfo) to remove this icon.
        Throws:
        javax.swing.text.BadLocationException - If offs is an invalid offset into the text area.
        See Also:
        addLineTrackingIcon(int, Icon), addOffsetTrackingIcon(int, Icon), removeTrackingIcon(GutterIconInfo)
      • addOffsetTrackingIcon

        public GutterIconInfo addOffsetTrackingIcon​(int offs,
                                                    javax.swing.Icon icon)
                                             throws javax.swing.text.BadLocationException
        Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. This is useful for marking things such as source code errors.
        Parameters:
        offs - The offset to track.
        icon - The icon to display. This should be small (say 16x16).
        Returns:
        A tag for this icon.
        Throws:
        javax.swing.text.BadLocationException - If offs is an invalid offset into the text area.
        See Also:
        addOffsetTrackingIcon(int, Icon, String), addLineTrackingIcon(int, Icon), removeTrackingIcon(GutterIconInfo)
      • addOffsetTrackingIcon

        public GutterIconInfo addOffsetTrackingIcon​(int offs,
                                                    javax.swing.Icon icon,
                                                    java.lang.String tip)
                                             throws javax.swing.text.BadLocationException
        Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. This is useful for marking things such as source code errors.
        Parameters:
        offs - The offset to track.
        icon - The icon to display. This should be small (say 16x16).
        tip - An optional tool tip for the icon.
        Returns:
        A tag for this icon.
        Throws:
        javax.swing.text.BadLocationException - If offs is an invalid offset into the text area.
        See Also:
        addOffsetTrackingIcon(int, Icon), addLineTrackingIcon(int, Icon), removeTrackingIcon(GutterIconInfo)
      • getActiveLineRangeColor

        public java.awt.Color getActiveLineRangeColor()
        Returns the color used to paint the active line range, if any.
        Returns:
        The color.
        See Also:
        setActiveLineRangeColor(Color)
      • getArmedFoldBackground

        public java.awt.Color getArmedFoldBackground()
        Returns the background color used by the (default) fold icons when they are armed.
        Returns:
        The background color.
        See Also:
        setArmedFoldBackground(Color), getFoldBackground()
      • getBookmarkIcon

        public javax.swing.Icon getBookmarkIcon()
        Returns the icon to use for bookmarks.
        Returns:
        The icon to use for bookmarks. If this is null, bookmarking is effectively disabled.
        See Also:
        setBookmarkIcon(Icon), isBookmarkingEnabled()
      • getBookmarks

        public GutterIconInfo[] getBookmarks()
        Returns the bookmarks known to this gutter.
        Returns:
        The bookmarks. If there are no bookmarks, an empty array is returned.
        See Also:
        toggleBookmark(int)
      • getBorderColor

        public java.awt.Color getBorderColor()
        Returns the color of the "border" line.
        Returns:
        The color.
        See Also:
        setBorderColor(Color)
      • getFoldBackground

        public java.awt.Color getFoldBackground()
        Returns the background color used by the (default) fold icons.
        Returns:
        The background color.
        See Also:
        setFoldBackground(Color)
      • getFoldIndicatorArmedForeground

        public java.awt.Color getFoldIndicatorArmedForeground()
        Returns the foreground color of the fold indicator for armed folds.
        Returns:
        The foreground color of the fold indicator for armed folds.
        See Also:
        setFoldIndicatorArmedForeground(Color)
      • getFoldIndicatorForeground

        public java.awt.Color getFoldIndicatorForeground()
        Returns the foreground color of the fold indicator.
        Returns:
        The foreground color of the fold indicator.
        See Also:
        setFoldIndicatorForeground(Color)
      • getIconRowHeaderInheritsGutterBackground

        public boolean getIconRowHeaderInheritsGutterBackground()
        Returns whether the icon area inherits the gutter background (as opposed to painting with its own, default "panel" color, which is the default).
        Returns:
        Whether the gutter background is used in the icon row header.
        See Also:
        setIconRowHeaderInheritsGutterBackground(boolean)
      • getLineNumberColor

        public java.awt.Color getLineNumberColor()
        Returns the color to use to paint line numbers.
        Returns:
        The color used when painting line numbers.
        See Also:
        setLineNumberColor(Color)
      • getLineNumberFont

        public java.awt.Font getLineNumberFont()
        Returns the font used for line numbers.
        Returns:
        The font used for line numbers.
        See Also:
        setLineNumberFont(Font)
      • getLineNumberingStartIndex

        public int getLineNumberingStartIndex()
        Returns the starting line's line number. The default value is 1.
        Returns:
        The index
        See Also:
        setLineNumberingStartIndex(int)
      • getLineNumbersEnabled

        public boolean getLineNumbersEnabled()
        Returns true if the line numbers are enabled and visible.
        Returns:
        Whether line numbers are visible.
      • getShowCollapsedRegionToolTips

        public boolean getShowCollapsedRegionToolTips()
        Returns whether tool tips are displayed showing the contents of collapsed fold regions when the mouse hovers over a +/- icon.
        Returns:
        Whether these tool tips are displayed.
        See Also:
        setShowCollapsedRegionToolTips(boolean)
      • getSpacingBetweenLineNumbersAndFoldIndicator

        public int getSpacingBetweenLineNumbersAndFoldIndicator()
        Returns the additional spacing between the line number list and fold indicator. By default this is a small amount; if you want something larger, you can increase it. Note this value takes effect whether both line numbers and the fold indicator are enabled, so use it only when both are enabled.
        Returns:
        The additional spacing.
        See Also:
        setSpacingBetweenLineNumbersAndFoldIndicator(int)
      • getTrackingIcons

        public GutterIconInfo[] getTrackingIcons​(java.awt.Point p)
                                          throws javax.swing.text.BadLocationException
        Returns the tracking icons at the specified view position.
        Parameters:
        p - The view position.
        Returns:
        The tracking icons at that position. If there are no tracking icons there, this will be an empty array.
        Throws:
        javax.swing.text.BadLocationException - If p is invalid.
      • isArmed

        public boolean isArmed()
        Returns whether this gutter is "armed", that is, any child components are armed. This is used by the internal API and should not be called.
        Returns:
        Whether the gutter is armed.
        See Also:
        setArmed(boolean)
      • isFoldIndicatorEnabled

        public boolean isFoldIndicatorEnabled()
        Returns whether the fold indicator is enabled.
        Returns:
        Whether the fold indicator is enabled.
        See Also:
        setFoldIndicatorEnabled(boolean)
      • isBookmarkingEnabled

        public boolean isBookmarkingEnabled()
        Returns whether bookmarking is enabled.
        Returns:
        Whether bookmarking is enabled.
        See Also:
        setBookmarkingEnabled(boolean)
      • isIconRowHeaderEnabled

        public boolean isIconRowHeaderEnabled()
        Returns whether the icon row header is enabled.
        Returns:
        Whether the icon row header is enabled.
      • setActiveLineRangeColor

        public void setActiveLineRangeColor​(java.awt.Color color)
        Sets the color to use to render active line ranges.
        Parameters:
        color - The color to use. If this is null, then the default color is used.
        See Also:
        getActiveLineRangeColor(), DEFAULT_ACTIVE_LINE_RANGE_COLOR
      • setActiveLineRange

        private void setActiveLineRange​(int startLine,
                                        int endLine)
        Highlights a range of lines in the icon area. This, of course, will only be visible if the icon area is visible.
        Parameters:
        startLine - The start of the line range.
        endLine - The end of the line range.
        See Also:
        clearActiveLineRange()
      • setArmed

        void setArmed​(boolean armed)
        Toggles whether this gutter is "armed", that is, any child components are armed. This is used by the internal API and should not be called.
        Parameters:
        armed - Whether the gutter is armed.
        See Also:
        isArmed()
      • setArmedFoldBackground

        public void setArmedFoldBackground​(java.awt.Color bg)
        Sets the background color used by the (default) fold icons when they are armed.
        Parameters:
        bg - The new background color. If this is null, then armed fold icons will not render with a special color.
        See Also:
        getArmedFoldBackground(), setFoldBackground(Color)
      • setBookmarkIcon

        public void setBookmarkIcon​(javax.swing.Icon icon)
        Sets the icon to use for bookmarks.
        Parameters:
        icon - The new bookmark icon. If this is null, bookmarking is effectively disabled.
        See Also:
        getBookmarkIcon(), isBookmarkingEnabled()
      • setBookmarkingEnabled

        public void setBookmarkingEnabled​(boolean enabled)
        Sets whether bookmarking is enabled. Note that a bookmarking icon must be set via setBookmarkIcon(Icon) before bookmarks are truly enabled.
        Parameters:
        enabled - Whether bookmarking is enabled.
        See Also:
        isBookmarkingEnabled(), setBookmarkIcon(Icon)
      • setBorderColor

        public void setBorderColor​(java.awt.Color color)
        Sets the color for the "border" line.
        Parameters:
        color - The new color.
        See Also:
        getBorderColor()
      • setComponentOrientation

        public void setComponentOrientation​(java.awt.ComponentOrientation o)
        Overrides:
        setComponentOrientation in class java.awt.Component
      • setFoldIndicatorEnabled

        public void setFoldIndicatorEnabled​(boolean enabled)
        Toggles whether the fold indicator is enabled.
        Parameters:
        enabled - Whether the fold indicator should be enabled.
        See Also:
        isFoldIndicatorEnabled()
      • setFoldIndicatorArmedForeground

        public void setFoldIndicatorArmedForeground​(java.awt.Color fg)
        Sets the foreground color used by the fold indicator for armed folds.
        Parameters:
        fg - The new armed fold indicator foreground.
        See Also:
        getFoldIndicatorArmedForeground()
      • setFoldIndicatorForeground

        public void setFoldIndicatorForeground​(java.awt.Color fg)
        Sets the foreground color used by the fold indicator.
        Parameters:
        fg - The new fold indicator foreground.
        See Also:
        getFoldIndicatorForeground()
      • setIconRowHeaderEnabled

        public void setIconRowHeaderEnabled​(boolean enabled)
        Toggles whether the icon row header (used for breakpoints, bookmarks, etc.) is enabled.

        Most clients do not need to call this method directly. This is usually handled by `RTextScrollPane` directly. Calling this directly may require the caller to ensure this `gutter` is visible and sized properly in its parent container.

        Parameters:
        enabled - Whether the icon row header is enabled.
        See Also:
        isIconRowHeaderEnabled()
      • setIconRowHeaderInheritsGutterBackground

        public void setIconRowHeaderInheritsGutterBackground​(boolean inherits)
        Sets whether the icon area inherits the gutter background (as opposed to painting with its own, default "panel" color, which is the default).
        Parameters:
        inherits - Whether the gutter background should be used in the icon row header. If this is false, a default, Look-and-feel-dependent color is used.
        See Also:
        getIconRowHeaderInheritsGutterBackground()
      • setLineNumberFont

        public void setLineNumberFont​(java.awt.Font font)
        Sets the font used for line numbers.
        Parameters:
        font - The font to use. This cannot be null.
        See Also:
        getLineNumberFont()
      • setLineNumberingStartIndex

        public void setLineNumberingStartIndex​(int index)
        Sets the starting line's line number. The default value is 1. Applications can call this method to change this value if they are displaying a subset of lines in a file, for example.
        Parameters:
        index - The new index.
        See Also:
        getLineNumberingStartIndex()
      • setLineNumberFormatter

        public void setLineNumberFormatter​(LineNumberFormatter formatter)
        Sets a custom line number formatter. Can be called when other number formats are needed like hindu-arabic numerals.
        Parameters:
        formatter - The new line number formatter.
        See Also:
        getLineNumberFormatter()
      • setLineNumbersEnabled

        public void setLineNumbersEnabled​(boolean enabled)
        Toggles whether line numbers are visible.

        Most clients do not need to call this method directly. This is usually handled by `RTextScrollPane` directly. Calling this directly may require the caller to ensure this `gutter` is visible and sized properly in its parent container.

        Parameters:
        enabled - Whether line numbers should be visible.
        See Also:
        getLineNumbersEnabled()
      • setShowCollapsedRegionToolTips

        public void setShowCollapsedRegionToolTips​(boolean show)
        Toggles whether tool tips should be displayed showing the contents of collapsed fold regions when the mouse hovers over a +/- icon.
        Parameters:
        show - Whether to show these tool tips.
        See Also:
        getShowCollapsedRegionToolTips()
      • setSpacingBetweenLineNumbersAndFoldIndicator

        public void setSpacingBetweenLineNumbersAndFoldIndicator​(int spacing)
        Sets additional spacing between the line number list and fold indicator. By default this is a small amount; if you want something larger, you can increase it. Note this value takes effect whether both line numbers and the fold indicator are enabled, so use it only when both are enabled.
        Parameters:
        spacing - The additional spacing. This should be >= 0.
        See Also:
        getSpacingBetweenLineNumbersAndFoldIndicator()
      • setTextArea

        public void setTextArea​(RTextArea textArea)
        Sets the text area being displayed. This will clear any tracking icons currently displayed.

        Most clients do not need to call this method directly. This is usually handled by `RTextScrollPane` directly.

        Parameters:
        textArea - The text area.
      • toggleBookmark

        public boolean toggleBookmark​(int line)
                               throws javax.swing.text.BadLocationException
        Programmatically toggles whether there is a bookmark for the specified line. If bookmarking is not enabled, this method does nothing.
        Parameters:
        line - The line.
        Returns:
        Whether a bookmark is now at the specified line.
        Throws:
        javax.swing.text.BadLocationException - If line is an invalid line number in the text area.
        See Also:
        getBookmarks()
      • setBorder

        public void setBorder​(javax.swing.border.Border border)
        Overrides:
        setBorder in class javax.swing.JComponent