Package jexer
Class TText
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TScrollableWidget
-
- jexer.TText
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
,Scrollable
public class TText extends TScrollableWidget
TText implements a simple scrollable text area. It reflows automatically on resize.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TText.Justification
Available text justifications.
-
Field Summary
-
Fields inherited from class jexer.TScrollableWidget
hScroller, vScroller
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLine(java.lang.String line)
Convenience method used by TWindowLoggerOutput.void
centerJustify()
Center-justify the text.void
draw()
Draw the text box.void
fullJustify()
Fully-justify the text.java.lang.String
getText()
Get the text.void
leftJustify()
Left-justify the text.void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse press events.void
reflowData()
Resize text and scrollbars for a new width/height.void
rightJustify()
Right-justify the text.void
setHeight(int height)
Override TWidget's height: we need to set child widget heights.void
setJustification(TText.Justification justification)
Set justification.void
setText(java.lang.String text)
Set the text.void
setWidth(int width)
Override TWidget's width: we need to set child widget widths.void
unJustify()
Un-justify the text.-
Methods inherited from class jexer.TScrollableWidget
bigHorizontalDecrement, bigHorizontalIncrement, bigVerticalDecrement, bigVerticalIncrement, getBottomValue, getHorizontalBigChange, getHorizontalScroller, getHorizontalSmallChange, getHorizontalValue, getLeftValue, getRightValue, getTopValue, getVerticalBigChange, getVerticalScroller, getVerticalSmallChange, getVerticalValue, horizontalDecrement, horizontalIncrement, onResize, placeScrollbars, setBottomValue, setHorizontalBigChange, setHorizontalSmallChange, setHorizontalValue, setLeftValue, setRightValue, setTopValue, setVerticalBigChange, setVerticalSmallChange, setVerticalValue, toBottom, toEnd, toHome, toLeft, toRight, toTop, verticalDecrement, verticalIncrement
-
Methods inherited from class jexer.TWidget
activate, activate, activate, activateAll, addButton, addCalendar, addCheckBox, addCheckBox, addComboBox, addDirectoryList, addDirectoryList, addDirectoryList, addDirectoryList, addEditor, addField, addField, addField, addField, addImage, addImage, addLabel, addLabel, addLabel, addLabel, addLabel, addLabel, addList, addList, addList, addList, addPanel, addPasswordField, addPasswordField, addPasswordField, addProgressBar, addRadioGroup, addRadioGroup, addSpinner, addSplitPane, addTable, addTable, addText, addText, addTreeViewWidget, addTreeViewWidget, close, compareTo, doRepaint, drawBox, drawBox, drawBoxShadow, drawChildren, fileOpenBox, fileOpenBox, fileOpenBox, fileOpenBox, fileSaveBox, getAbsoluteX, getAbsoluteY, getActiveChild, getApplication, getAttrXY, getChildren, getClipboard, getCursorAbsoluteX, getCursorAbsoluteY, getCursorX, getCursorY, getHeight, getLayoutManager, getParent, getScreen, getTheme, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isVisible, messageBox, messageBox, mouseWouldHit, onCommand, onIdle, onMenu, onMouseDoubleClick, onMouseMotion, onMouseUp, putAll, putAttrXY, putAttrXY, putCharXY, putCharXY, putCharXY, putStringXY, putStringXY, remove, remove, remove, remove, removeAll, resetTabOrder, setActive, setCursorVisible, setCursorX, setCursorY, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setLayoutManager, setParent, setupForTWindow, setVisible, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY
-
-
-
-
Constructor Detail
-
TText
public TText(TWidget parent, java.lang.String text, int x, int y, int width, int height)
Public constructor.- Parameters:
parent
- parent widgettext
- text on the screenx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area
-
TText
public TText(TWidget parent, java.lang.String text, int x, int y, int width, int height, java.lang.String colorKey)
Public constructor.- Parameters:
parent
- parent widgettext
- text on the screenx
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text areacolorKey
- ColorTheme key color to use for foreground text. Default is "ttext".
-
-
Method Detail
-
setWidth
public void setWidth(int width)
Override TWidget's width: we need to set child widget widths.
-
setHeight
public void setHeight(int height)
Override TWidget's height: we need to set child widget heights. time.
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse press events.- Overrides:
onMouseDown
in classTWidget
- Parameters:
mouse
- mouse button press event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWidget
- Parameters:
keypress
- keystroke event
-
reflowData
public void reflowData()
Resize text and scrollbars for a new width/height.- Overrides:
reflowData
in classTScrollableWidget
-
setText
public void setText(java.lang.String text)
Set the text.- Parameters:
text
- new text to display
-
getText
public java.lang.String getText()
Get the text.- Returns:
- the text
-
addLine
public void addLine(java.lang.String line)
Convenience method used by TWindowLoggerOutput.- Parameters:
line
- new line to add
-
setJustification
public void setJustification(TText.Justification justification)
Set justification.- Parameters:
justification
- NONE, LEFT, CENTER, RIGHT, or FULL
-
leftJustify
public void leftJustify()
Left-justify the text.
-
centerJustify
public void centerJustify()
Center-justify the text.
-
rightJustify
public void rightJustify()
Right-justify the text.
-
fullJustify
public void fullJustify()
Fully-justify the text.
-
unJustify
public void unJustify()
Un-justify the text.
-
-