Class LimitLinesDocumentListener

java.lang.Object
be.gaudry.swing.utils.console.LimitLinesDocumentListener
All Implemented Interfaces:
EventListener, DocumentListener

public class LimitLinesDocumentListener extends Object implements DocumentListener
A class to control the maximum number of lines to be stored in a Document Excess lines can be removed from the start or end of the Document depending on your requirement. a) if you append text to the Document, then you would want to remove lines from the start. b) if you insert text at the beginning of the Document, then you would want to remove lines from the end. found on http://www.tips4java.wordpress.com
Since:
1.0 Nov 25, 2009, 1.0
Version:
%I%, %G%
Author:
Steph GAUDRY
  • Constructor Details

    • LimitLinesDocumentListener

      public LimitLinesDocumentListener(int maximumLines)
      Parameters:
      maximumLines - Specify the number of lines to be stored in the Document. Extra lines will be removed from the start of the Document.
    • LimitLinesDocumentListener

      public LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
      Specify the number of lines to be stored in the Document. Extra lines will be removed from the start or end of the Document, depending on the boolean value specified.
      Parameters:
      maximumLines -
      isRemoveFromStart -
  • Method Details

    • getLimitLines

      public int getLimitLines()
      Returns:
      Return the maximum number of lines to be stored in the Document
    • setLimitLines

      public void setLimitLines(int maximumLines)
      Sets the maximum number of lines to be stored in the Document
      Parameters:
      maximumLines -
    • insertUpdate

      public void insertUpdate(DocumentEvent e)
      Specified by:
      insertUpdate in interface DocumentListener
    • removeUpdate

      public void removeUpdate(DocumentEvent e)
      Specified by:
      removeUpdate in interface DocumentListener
    • changedUpdate

      public void changedUpdate(DocumentEvent e)
      Specified by:
      changedUpdate in interface DocumentListener