Class LineNumberList

    • Field Detail

      • textArea

        protected RTextArea textArea
        The text area whose lines we are marking with icons.
      • currentLineCount

        protected int currentLineCount
        The number of lines in the text area.
    • Constructor Detail

      • LineNumberList

        public LineNumberList​(RTextArea textArea)
        Constructs a new LineNumberList using default values for line number color (gray) and highlighting the current line.
        Parameters:
        textArea - The text component for which line numbers will be displayed.
      • LineNumberList

        public LineNumberList​(RTextArea textArea,
                              Color numberColor)
        Constructs a new LineNumberList.
        Parameters:
        textArea - The text component for which line numbers will be displayed.
        numberColor - The color to use for the line numbers. If this is null, gray will be used.
    • Method Detail

      • addNotify

        public void addNotify()
        Overridden to set width of this component correctly when we are first displayed (as keying off of the RTextArea gives us (0,0) when it isn't yet displayed.
        Overrides:
        addNotify in class JComponent
      • getLineNumberingStartIndex

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

        protected void init()
        Called by the constructor before the text area is set. This is a hook to allow subclasses to do any needed initialization. The default implementation does nothing.
      • paintComponent

        protected void paintComponent​(Graphics g)
        Paints this component.
        Overrides:
        paintComponent in class JComponent
        Parameters:
        g - The graphics context.
      • removeNotify

        public void removeNotify()
        Called when this component is removed from the view hierarchy.
        Overrides:
        removeNotify in class JComponent
      • setFont

        public void setFont​(Font font)
        Overridden to ensure line number cell sizes are updated with the font size change.
        Overrides:
        setFont in class JComponent
        Parameters:
        font - The new font to use for line numbers.
      • 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()
      • setTextArea

        public void setTextArea​(RTextArea textArea)
        Sets the text area being displayed.
        Parameters:
        textArea - The text area.
      • getChildViewBounds

        protected static final Rectangle getChildViewBounds​(View parent,
                                                            int line,
                                                            Rectangle editorRect)
        Returns the bounds of a child view as a rectangle, since Views tend to use Shape.
        Parameters:
        parent - The parent view of the child whose bounds we're getting.
        line - The index of the child view.
        editorRect - Returned from the text area's getVisibleEditorRect method.
        Returns:
        The child view's bounds.
      • getGutter

        protected Gutter getGutter()
        Returns the parent Gutter component.
        Returns:
        The parent Gutter.