Package jexer
Class TScrollableWidget
- java.lang.Object
-
- jexer.TWidget
-
- jexer.TScrollableWidget
-
- All Implemented Interfaces:
java.lang.Comparable<TWidget>,Scrollable
- Direct Known Subclasses:
THelpText,TList,TTerminalWidget,TText,TTextPicture,TTreeViewWidget
public class TScrollableWidget extends TWidget implements Scrollable
TScrollableWidget is a convenience superclass for widgets that have scrollbars.
-
-
Field Summary
Fields Modifier and Type Field Description protected THScrollerhScrollerThe horizontal scrollbar.protected TVScrollervScrollerThe vertical scrollbar.
-
Constructor Summary
Constructors Modifier Constructor Description protectedTScrollableWidget(TWidget parent)Protected constructor.protectedTScrollableWidget(TWidget parent, boolean enabled)Protected constructor used by subclasses that are disabled by default.protectedTScrollableWidget(TWidget parent, boolean enabled, int x, int y, int width, int height)Protected constructor used by subclasses that are disabled by default.protectedTScrollableWidget(TWidget parent, int x, int y, int width, int height)Protected constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbigHorizontalDecrement()Perform a big step change left.voidbigHorizontalIncrement()Perform a big step change right.voidbigVerticalDecrement()Perform a big step change up.voidbigVerticalIncrement()Perform a big step change down.intgetBottomValue()Get the value that corresponds to being on the bottom edge of the vertical scroll bar.intgetHorizontalBigChange()Get the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.THScrollergetHorizontalScroller()Get the horizontal scrollbar, or null if this Viewport does not support horizontal scrolling.intgetHorizontalSmallChange()Get the increment for clicking on an arrow on the horizontal scrollbar.intgetHorizontalValue()Get current value of the horizontal scroll.intgetLeftValue()Get the value that corresponds to being on the left edge of the horizontal scroll bar.intgetRightValue()Get the value that corresponds to being on the right edge of the horizontal scroll bar.intgetTopValue()Get the value that corresponds to being on the top edge of the vertical scroll bar.intgetVerticalBigChange()Get the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.TVScrollergetVerticalScroller()Get the vertical scrollbar, or null if this Viewport does not support vertical scrolling.intgetVerticalSmallChange()Get the increment for clicking on an arrow on the vertical scrollbar.intgetVerticalValue()Get current value of the vertical scroll.voidhorizontalDecrement()Perform a small step change left.voidhorizontalIncrement()Perform a small step change right.voidonResize(TResizeEvent event)Handle window/screen resize events.protected voidplaceScrollbars()Place the scrollbars on the edge of this widget, and adjust bigChange to match the new size.voidreflowData()Recompute whatever data is displayed by this widget.voidsetBottomValue(int bottomValue)Set the value that corresponds to being on the bottom edge of the vertical scroll bar.voidsetHorizontalBigChange(int bigChange)Set the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.voidsetHorizontalSmallChange(int smallChange)Set the increment for clicking on an arrow on the horizontal scrollbar.voidsetHorizontalValue(int value)Set current value of the horizontal scroll.voidsetLeftValue(int leftValue)Set the value that corresponds to being on the left edge of the horizontal scroll bar.voidsetRightValue(int rightValue)Set the value that corresponds to being on the right edge of the horizontal scroll bar.voidsetTopValue(int topValue)Set the value that corresponds to being on the top edge of the vertical scroll bar.voidsetVerticalBigChange(int bigChange)Set the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.voidsetVerticalSmallChange(int smallChange)Set the increment for clicking on an arrow on the vertical scrollbar.voidsetVerticalValue(int value)Set current value of the vertical scroll.voidtoBottom()Go to the bottom edge of the vertical scroller.voidtoEnd()Go to the bottom-right edge of the horizontal and vertical scrollers.voidtoHome()Go to the top-left edge of the horizontal and vertical scrollers.voidtoLeft()Go to the left edge of the horizontal scroller.voidtoRight()Go to the right edge of the horizontal scroller.voidtoTop()Go to the top edge of the vertical scroller.voidverticalDecrement()Perform a small step change up.voidverticalIncrement()Perform a small step change down.-
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, draw, 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, onKeypress, onMenu, onMouseDoubleClick, onMouseDown, 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
-
-
-
-
Field Detail
-
hScroller
protected THScroller hScroller
The horizontal scrollbar.
-
vScroller
protected TVScroller vScroller
The vertical scrollbar.
-
-
Constructor Detail
-
TScrollableWidget
protected TScrollableWidget(TWidget parent)
Protected constructor.- Parameters:
parent- parent widget
-
TScrollableWidget
protected TScrollableWidget(TWidget parent, int x, int y, int width, int height)
Protected constructor.- Parameters:
parent- parent widgetx- column relative to parenty- row relative to parentwidth- width of widgetheight- height of widget
-
TScrollableWidget
protected TScrollableWidget(TWidget parent, boolean enabled)
Protected constructor used by subclasses that are disabled by default.- Parameters:
parent- parent widgetenabled- if true assume enabled
-
TScrollableWidget
protected TScrollableWidget(TWidget parent, boolean enabled, int x, int y, int width, int height)
Protected constructor used by subclasses that are disabled by default.- Parameters:
parent- parent widgetenabled- if true assume enabledx- column relative to parenty- row relative to parentwidth- width of widgetheight- height of widget
-
-
Method Detail
-
onResize
public void onResize(TResizeEvent event)
Handle window/screen resize events.
-
placeScrollbars
protected void placeScrollbars()
Place the scrollbars on the edge of this widget, and adjust bigChange to match the new size. This is called by onResize().
-
reflowData
public void reflowData()
Recompute whatever data is displayed by this widget.
-
getHorizontalScroller
public THScroller getHorizontalScroller()
Get the horizontal scrollbar, or null if this Viewport does not support horizontal scrolling.- Specified by:
getHorizontalScrollerin interfaceScrollable- Returns:
- the horizontal scrollbar
-
getVerticalScroller
public TVScroller getVerticalScroller()
Get the vertical scrollbar, or null if this Viewport does not support vertical scrolling.- Specified by:
getVerticalScrollerin interfaceScrollable- Returns:
- the vertical scrollbar
-
getTopValue
public int getTopValue()
Get the value that corresponds to being on the top edge of the vertical scroll bar.- Specified by:
getTopValuein interfaceScrollable- Returns:
- the scroll value
-
setTopValue
public void setTopValue(int topValue)
Set the value that corresponds to being on the top edge of the vertical scroll bar.- Specified by:
setTopValuein interfaceScrollable- Parameters:
topValue- the new scroll value
-
getBottomValue
public int getBottomValue()
Get the value that corresponds to being on the bottom edge of the vertical scroll bar.- Specified by:
getBottomValuein interfaceScrollable- Returns:
- the scroll value
-
setBottomValue
public void setBottomValue(int bottomValue)
Set the value that corresponds to being on the bottom edge of the vertical scroll bar.- Specified by:
setBottomValuein interfaceScrollable- Parameters:
bottomValue- the new scroll value
-
getVerticalValue
public int getVerticalValue()
Get current value of the vertical scroll.- Specified by:
getVerticalValuein interfaceScrollable- Returns:
- the scroll value
-
setVerticalValue
public void setVerticalValue(int value)
Set current value of the vertical scroll.- Specified by:
setVerticalValuein interfaceScrollable- Parameters:
value- the new scroll value
-
getVerticalSmallChange
public int getVerticalSmallChange()
Get the increment for clicking on an arrow on the vertical scrollbar.- Specified by:
getVerticalSmallChangein interfaceScrollable- Returns:
- the increment value
-
setVerticalSmallChange
public void setVerticalSmallChange(int smallChange)
Set the increment for clicking on an arrow on the vertical scrollbar.- Specified by:
setVerticalSmallChangein interfaceScrollable- Parameters:
smallChange- the new increment value
-
getVerticalBigChange
public int getVerticalBigChange()
Get the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.- Specified by:
getVerticalBigChangein interfaceScrollable- Returns:
- the increment value
-
setVerticalBigChange
public void setVerticalBigChange(int bigChange)
Set the increment for clicking in the bar between the box and an arrow on the vertical scrollbar.- Specified by:
setVerticalBigChangein interfaceScrollable- Parameters:
bigChange- the new increment value
-
verticalDecrement
public void verticalDecrement()
Perform a small step change up.- Specified by:
verticalDecrementin interfaceScrollable
-
verticalIncrement
public void verticalIncrement()
Perform a small step change down.- Specified by:
verticalIncrementin interfaceScrollable
-
bigVerticalDecrement
public void bigVerticalDecrement()
Perform a big step change up.- Specified by:
bigVerticalDecrementin interfaceScrollable
-
bigVerticalIncrement
public void bigVerticalIncrement()
Perform a big step change down.- Specified by:
bigVerticalIncrementin interfaceScrollable
-
toTop
public void toTop()
Go to the top edge of the vertical scroller.- Specified by:
toTopin interfaceScrollable
-
toBottom
public void toBottom()
Go to the bottom edge of the vertical scroller.- Specified by:
toBottomin interfaceScrollable
-
getLeftValue
public int getLeftValue()
Get the value that corresponds to being on the left edge of the horizontal scroll bar.- Specified by:
getLeftValuein interfaceScrollable- Returns:
- the scroll value
-
setLeftValue
public void setLeftValue(int leftValue)
Set the value that corresponds to being on the left edge of the horizontal scroll bar.- Specified by:
setLeftValuein interfaceScrollable- Parameters:
leftValue- the new scroll value
-
getRightValue
public int getRightValue()
Get the value that corresponds to being on the right edge of the horizontal scroll bar.- Specified by:
getRightValuein interfaceScrollable- Returns:
- the scroll value
-
setRightValue
public void setRightValue(int rightValue)
Set the value that corresponds to being on the right edge of the horizontal scroll bar.- Specified by:
setRightValuein interfaceScrollable- Parameters:
rightValue- the new scroll value
-
getHorizontalValue
public int getHorizontalValue()
Get current value of the horizontal scroll.- Specified by:
getHorizontalValuein interfaceScrollable- Returns:
- the scroll value
-
setHorizontalValue
public void setHorizontalValue(int value)
Set current value of the horizontal scroll.- Specified by:
setHorizontalValuein interfaceScrollable- Parameters:
value- the new scroll value
-
getHorizontalSmallChange
public int getHorizontalSmallChange()
Get the increment for clicking on an arrow on the horizontal scrollbar.- Specified by:
getHorizontalSmallChangein interfaceScrollable- Returns:
- the increment value
-
setHorizontalSmallChange
public void setHorizontalSmallChange(int smallChange)
Set the increment for clicking on an arrow on the horizontal scrollbar.- Specified by:
setHorizontalSmallChangein interfaceScrollable- Parameters:
smallChange- the new increment value
-
getHorizontalBigChange
public int getHorizontalBigChange()
Get the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.- Specified by:
getHorizontalBigChangein interfaceScrollable- Returns:
- the increment value
-
setHorizontalBigChange
public void setHorizontalBigChange(int bigChange)
Set the increment for clicking in the bar between the box and an arrow on the horizontal scrollbar.- Specified by:
setHorizontalBigChangein interfaceScrollable- Parameters:
bigChange- the new increment value
-
horizontalDecrement
public void horizontalDecrement()
Perform a small step change left.- Specified by:
horizontalDecrementin interfaceScrollable
-
horizontalIncrement
public void horizontalIncrement()
Perform a small step change right.- Specified by:
horizontalIncrementin interfaceScrollable
-
bigHorizontalDecrement
public void bigHorizontalDecrement()
Perform a big step change left.- Specified by:
bigHorizontalDecrementin interfaceScrollable
-
bigHorizontalIncrement
public void bigHorizontalIncrement()
Perform a big step change right.- Specified by:
bigHorizontalIncrementin interfaceScrollable
-
toLeft
public void toLeft()
Go to the left edge of the horizontal scroller.- Specified by:
toLeftin interfaceScrollable
-
toRight
public void toRight()
Go to the right edge of the horizontal scroller.- Specified by:
toRightin interfaceScrollable
-
toHome
public void toHome()
Go to the top-left edge of the horizontal and vertical scrollers.- Specified by:
toHomein interfaceScrollable
-
toEnd
public void toEnd()
Go to the bottom-right edge of the horizontal and vertical scrollers.- Specified by:
toEndin interfaceScrollable
-
-