Class RTextScrollPane

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants

    public class RTextScrollPane
    extends JScrollPane
    An extension of JScrollPane that will only take RTextAreas (or javax.swing.JLayers decorating RTextAreas) for its view. This class has the ability to show:
    • Line numbers
    • Per-line icons (for bookmarks, debugging breakpoints, error markers, etc.)
    • +/- icons to denote code folding regions.
    The actual "meat" of these extras is contained in the Gutter class. Each RTextScrollPane has a Gutter instance that it uses as its row header. The gutter is only made visible when one of its features is being used (line numbering, folding, and/or icons).
    See Also:
    Serialized Form
    • Constructor Detail

      • RTextScrollPane

        public RTextScrollPane()
        Constructor. If you use this constructor, you must call setViewportView(Component) and pass in an RTextArea for this scroll pane to render line numbers properly.
      • RTextScrollPane

        public RTextScrollPane​(RTextArea textArea)
        Creates a scroll pane. A default value will be used for line number color (gray), and the current line's line number will be highlighted.
        Parameters:
        textArea - The text area this scroll pane will contain.
      • RTextScrollPane

        public RTextScrollPane​(Component comp)
        Creates a scroll pane. A default value will be used for line number color (gray), and the current line's line number will be highlighted.
        Parameters:
        comp - The component this scroll pane should display. This should be an instance of RTextArea, javax.swing.JLayer (or the older org.jdesktop.jxlayer.JXLayer), or null. If this argument is null, you must call setViewportView(Component), passing in an instance of one of the types above.
      • RTextScrollPane

        public RTextScrollPane​(RTextArea textArea,
                               boolean lineNumbers)
        Creates a scroll pane. A default value will be used for line number color (gray), and the current line's line number will be highlighted.
        Parameters:
        textArea - The text area this scroll pane will contain. If this is null, you must call setViewportView(Component), passing in an RTextArea.
        lineNumbers - Whether line numbers should be enabled.
      • RTextScrollPane

        public RTextScrollPane​(Component comp,
                               boolean lineNumbers)
        Creates a scroll pane. A default value will be used for line number color (gray), and the current line's line number will be highlighted.
        Parameters:
        comp - The component this scroll pane should display. This should be an instance of RTextArea, javax.swing.JLayer (or the older org.jdesktop.jxlayer.JXLayer), or null. If this argument is null, you must call setViewportView(Component), passing in an instance of one of the types above.
        lineNumbers - Whether line numbers should be enabled.
      • RTextScrollPane

        public RTextScrollPane​(Component comp,
                               boolean lineNumbers,
                               Color lineNumberColor)
        Creates a scroll pane.
        Parameters:
        comp - The component this scroll pane should display. This should be an instance of RTextArea, javax.swing.JLayer (or the older org.jdesktop.jxlayer.JXLayer), or null. If this argument is null, you must call setViewportView(Component), passing in an instance of one of the types above.
        lineNumbers - Whether line numbers are initially enabled.
        lineNumberColor - The color to use for line numbers.
    • Method Detail

      • getGutter

        public Gutter getGutter()
        Returns the gutter.
        Returns:
        The gutter.
      • getLineNumbersEnabled

        public boolean getLineNumbersEnabled()
        Returns true if the line numbers are enabled and visible.
        Returns:
        Whether or not line numbers are visible.
        See Also:
        setLineNumbersEnabled(boolean)
      • isFoldIndicatorEnabled

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

        public boolean isIconRowHeaderEnabled()
        Returns whether the icon row header is enabled.
        Returns:
        Whether the icon row header is enabled.
        See Also:
        setIconRowHeaderEnabled(boolean)
      • 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()
      • setIconRowHeaderEnabled

        public void setIconRowHeaderEnabled​(boolean enabled)
        Toggles whether the icon row header (used for breakpoints, bookmarks, etc.) is enabled.
        Parameters:
        enabled - Whether the icon row header is enabled.
        See Also:
        isIconRowHeaderEnabled()
      • setLineNumbersEnabled

        public void setLineNumbersEnabled​(boolean enabled)
        Toggles whether or not line numbers are visible.
        Parameters:
        enabled - Whether or not line numbers should be visible.
        See Also:
        getLineNumbersEnabled()