Package be.gaudry.swing.utils.console
Class LimitLinesDocumentListener
java.lang.Object
be.gaudry.swing.utils.console.LimitLinesDocumentListener
- All Implemented Interfaces:
EventListener
,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 Summary
ConstructorDescriptionLimitLinesDocumentListener(int maximumLines)
LimitLinesDocumentListener(int maximumLines, boolean isRemoveFromStart)
Specify the number of lines to be stored in the Document. -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
void
void
void
setLimitLines(int maximumLines)
Sets the maximum number of lines to be stored in the Document
-
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
- Specified by:
insertUpdate
in interfaceDocumentListener
-
removeUpdate
- Specified by:
removeUpdate
in interfaceDocumentListener
-
changedUpdate
- Specified by:
changedUpdate
in interfaceDocumentListener
-