Class JLineScrollingTextPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, ScrollPaneConstants
Direct Known Subclasses:
JScrollingLog

public class JLineScrollingTextPane extends JScrollPane
This is almost identical to the JScrollingTextPane except this does not use buffer size but line number as its determiner of when to remove lines from the buffer. As such, this can make now guarantees of size but is more human friendly in that it only removes lines. When 1 line is added which causes the total number of lines to be exceeded, the last line is removed.
See Also:
  • Constructor Details

    • JLineScrollingTextPane

      public JLineScrollingTextPane(int width, int height)
    • JLineScrollingTextPane

      public JLineScrollingTextPane()
  • Method Details

    • setThreshold

      public void setThreshold(int t)
      Set the threshold. This is the number of pixels from the bottom of the window at which auto-scrolling stops.
    • getThreshold

      public int getThreshold()
      Get the threshold. This is the distance from the bottom of the window at which auto scrolling stops.
    • setScrollback

      public void setScrollback(int s)
      The maximum number of lines this can hold. Resetting this value destroys the current contents.
    • getScrollback

      public int getScrollback()
    • getStyledDocument

      public StyledDocument getStyledDocument()
      Return the styled document for this so that styles may be added.
    • getJTextPane

      public JTextPane getJTextPane()
    • getJViewport

      public JViewport getJViewport()
    • append

      public void append(String s)
      Append what is considered a line. Note that lines don't need to end in a "\n". Lines are removed in the blocking by which they were added.
      Parameters:
      s - string to append.
    • append

      public void append(String s, String sty)
      Append what is considered a line. Note that lines don't need to end in a "\n". Lines are removed in the blocking by which they were added.
      Parameters:
      s - string to append.
      sty - style to use.
    • removeLine

      public String removeLine()
      Remove the last line if one exists.
      Returns:
      A string is always returned. If there is no content the string "" is returned.
    • willScroll

      public boolean willScroll()
      Returns if the window is in a position to scroll or not.
    • scrollToBottom

      public void scrollToBottom()
    • main

      public static void main(String[] argv)