Package jexer
Class TTextPicture
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TScrollableWidget
-
- jexer.TTextPicture
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>
,Scrollable
,DisplayListener
public class TTextPicture extends TScrollableWidget implements DisplayListener
TTextPicture displays a color-and-text canvas, also called "ANSI Art" or "ASCII Art".
-
-
Field Summary
-
Fields inherited from class jexer.TScrollableWidget
hScroller, vScroller
-
-
Constructor Summary
Constructors Constructor Description TTextPicture(TWidget parent, java.lang.String filename, int x, int y, int width, int height)
Public constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Handle widget close.void
displayChanged(boolean cursorOnly)
Called by emulator when fresh data has come in (request poll).void
draw()
Draw the text box.int
getDisplayHeight()
Function to call to obtain the display height.int
getDisplayWidth()
Function to call to obtain the display width.int
getScrollBottom()
Function to call to obtain the number of rows from the bottom to scroll back when sending updates via updateDisplay().void
onKeypress(TKeypressEvent keypress)
Handle keystrokes.void
onMouseDown(TMouseEvent mouse)
Handle mouse press events.void
onResize(TResizeEvent resize)
Handle window/screen resize events.void
reflowData()
Resize scrollbars for a new width/height.void
updateDisplay(java.util.List<DisplayLine> display)
Called by emulator when fresh data has come in (push).-
Methods inherited from class jexer.TScrollableWidget
bigHorizontalDecrement, bigHorizontalIncrement, bigVerticalDecrement, bigVerticalIncrement, getBottomValue, getHorizontalBigChange, getHorizontalScroller, getHorizontalSmallChange, getHorizontalValue, getLeftValue, getRightValue, getTopValue, getVerticalBigChange, getVerticalScroller, getVerticalSmallChange, getVerticalValue, horizontalDecrement, horizontalIncrement, 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, 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, setHeight, setLayoutManager, setLocale, setMouseStyle, setParent, setupForTWindow, setVisible, setWidth, setWindow, setX, setY, splitHorizontal, splitVertical, switchWidget, toPrettyString, toPrettyString, toString, vLineXY, vLineXY
-
-
-
-
Constructor Detail
-
TTextPicture
public TTextPicture(TWidget parent, java.lang.String filename, int x, int y, int width, int height)
Public constructor.- Parameters:
parent
- parent widgetfilename
- the file containing the picture datax
- column relative to parenty
- row relative to parentwidth
- width of text areaheight
- height of text area
-
-
Method Detail
-
onResize
public void onResize(TResizeEvent resize)
Handle window/screen resize events.- Overrides:
onResize
in classTScrollableWidget
- Parameters:
resize
- resize event
-
onKeypress
public void onKeypress(TKeypressEvent keypress)
Handle keystrokes.- Overrides:
onKeypress
in classTWidget
- Parameters:
keypress
- keystroke event
-
onMouseDown
public void onMouseDown(TMouseEvent mouse)
Handle mouse press events.- Overrides:
onMouseDown
in classTWidget
- Parameters:
mouse
- mouse button press event
-
reflowData
public void reflowData()
Resize scrollbars for a new width/height.- Overrides:
reflowData
in classTScrollableWidget
-
displayChanged
public void displayChanged(boolean cursorOnly)
Called by emulator when fresh data has come in (request poll).- Specified by:
displayChanged
in interfaceDisplayListener
- Parameters:
cursorOnly
- if true, the screen has not changed but the cursor may be on a different location.
-
updateDisplay
public void updateDisplay(java.util.List<DisplayLine> display)
Called by emulator when fresh data has come in (push).- Specified by:
updateDisplay
in interfaceDisplayListener
- Parameters:
display
- the updated display
-
getScrollBottom
public int getScrollBottom()
Function to call to obtain the number of rows from the bottom to scroll back when sending updates via updateDisplay().- Specified by:
getScrollBottom
in interfaceDisplayListener
- Returns:
- the number of rows from the bottom to scroll back
-
getDisplayWidth
public int getDisplayWidth()
Function to call to obtain the display width.- Specified by:
getDisplayWidth
in interfaceDisplayListener
- Returns:
- the number of columns in the display
-
getDisplayHeight
public int getDisplayHeight()
Function to call to obtain the display height.- Specified by:
getDisplayHeight
in interfaceDisplayListener
- Returns:
- the number of rows in the display
-
-