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 classTText.JustificationAvailable 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 voidaddLine(java.lang.String line)Add one line.voidcenterJustify()Center-justify the text.voiddraw()Draw the text box.voidfullJustify()Fully-justify the text.java.lang.StringgetText()Get the text.voidleftJustify()Left-justify the text.voidonKeypress(TKeypressEvent keypress)Handle keystrokes.voidonMouseDown(TMouseEvent mouse)Handle mouse press events.voidreflowData()Resize text and scrollbars for a new width/height.voidrightJustify()Right-justify the text.voidsetHeight(int height)Override TWidget's height: we need to set child widget heights.voidsetJustification(TText.Justification justification)Set justification.voidsetLineSpacing(int lineSpacing)Set the number of lines between each paragraph.voidsetText(java.lang.String text)Set the text.voidsetWidth(int width)Override TWidget's width: we need to set child widget widths.voidunJustify()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, 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, getCustomMousePointer, getHeight, getLayoutManager, getLocale, getMouseStyle, getParent, getScreen, getTheme, getWidgetUnderMouse, getWidth, getWindow, getX, getY, handleEvent, hasChild, hLineXY, hLineXY, inputBox, inputBox, inputBox, isAbsoluteActive, isActive, isCursorVisible, isDrawable, isEchoKeystrokes, isEnabled, isPixelMouse, 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, setCustomMousePointer, setDimensions, setEchoKeystrokes, setEchoKeystrokes, setEnabled, setLayoutManager, setLocale, setMouseStyle, setParent, setupForTWindow, setVisible, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY, 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:
onMouseDownin classTWidget- Parameters:
mouse- mouse button press event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypressin classTWidget- Parameters:
keypress- keystroke event
-
reflowData
public void reflowData()
Resize text and scrollbars for a new width/height.- Overrides:
reflowDatain 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)
Add one line.- 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.
-
setLineSpacing
public void setLineSpacing(int lineSpacing)
Set the number of lines between each paragraph.- Parameters:
lineSpacing- the number of blank lines between paragraphs
-
-