Package totalcross.ui.tree
Class Tree
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.tree.Tree
-
- All Implemented Interfaces:
EventHandler,KeyListener,PenListener,PressListener,Scrollable
public class Tree extends Container implements PressListener, PenListener, KeyListener, Scrollable
This class is a simple implementation of a tree widget. Since it's natural to render the tree in rows, this class borrows most of the code from ListBox. Features:- similar to Microsoft Windows Explorer tree
- horizontal and vertical scrolling
- allows setting of folder and leaf icons.
- expands and collapse of folder
- allowsChildren flag to determine if the node is a leaf or folder
- delete, insert, and modify (user object) of a node
- clicking on leaf node will swap leaf icon (like hyperlink)
- allows creation of tree to show or hide root node.
TreeModel tmodel = new TreeModel(); Tree tree = new Tree(tmodel); add(tree,LEFT,TOP,FILL,FILL); Node root = new Node("Tree"); tmodel.setRoot(root); Node n; root.add(n = new Node("Branch1")); n.add(new Node("SubBranch1")); n.add(new Node("SubBranch2"));You can also see the FileChooserBox control and FileChooserTest (in UIGadgets sample).- See Also:
Node.userObject
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description protected intbtnXbooleanexpandClickingOnTextSet to false to only expand or collapse if you click on the +- buttons.protected FlickflickThe Flick object listens and performs flick animations on PenUp events when appropriate.protected ScrollBarhbarprotected inthsCountprotected inthsOffsetstatic intICON_CLOSEstatic intICON_FILEstatic intICON_MINUSstatic intICON_OPENstatic intICON_PLUSprotected ImageimgCloseprotected ImageimgFileprotected ImageimgMinusprotected ImageimgOpenprotected ImageimgPlusprotected intitemCountprotected VectoritemsintlineHDeprecated.Use setLineHeight and getLineHeightprotected TreeModelmodelbooleanmultipleSelectionSet to true to allow multiple selections using a Check drawn before the nodes.protected intoffsetstatic intSCROLLBAR_ALWAYSstatic intSCROLLBAR_AS_NEEDEDstatic intSCROLLBAR_NEVERprotected intselectedIndexbooleanuseFullWidthOnSelectionIf true, all Tree will have the selection bar drawn in the full width instead of the selected's text widthprotected ScrollBarvbarprotected intvisibleItems-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, borderRadius, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastScreenWidth, lastW, lastX, lastY, npback, numChildren, started, tabOrder, tail, TRANSITION_TIME
-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionkeyPressed(KeyEvent e)An ACTION_KEY_PRESS event was dispatched.voidadd(Control control)Do nothing.booleancanScrollContent(int direction, java.lang.Object target)Checks if there is room to flick this container in the given direction.voidcheckClicked(int sel)voidclear()Same as removeAll() method.booleancollapse(Node node)Method to collapse an expanded node.voidcontrolPressed(ControlEvent e)A PRESSED event was dispatched.voiddontShowFileAndFolderIcons()Call this method to hide the file and folder icons.protected voiddrawConnector(Graphics g, int index, int dx, int dy, Node node)Method to draw the (line connector) angled line.protected voiddrawCursor(Graphics g, int sel)Method to draw the highlight box when user select a listbox's item.protected voiddrawFileImage(Graphics g, Node node, int x, int y)Allows the draw of customized file images.protected voiddrawNode(Graphics g, int index, int dx, int dy)Method to draw the icons and node textbooleanexpand(Node node)Method to expand a collapsed node.voidexpandTo(java.lang.String filePath)Expands all nodes until the given path is reachedprotected voidfind(char c)Method to search this Tree for an item with the first letter matching the given char.voidflickEnded(boolean atPenDown)Called when the flick animation is ended.booleanflickStarted()Called when the flick animation is started.FlickgetFlick()Returns the current flick object.voidgetFocusableControls(Vector v)Get a list of child controls of this container which are focus candidatesjava.lang.ObjectgetItemAt(int i)Method to get the Object at the given Index.java.lang.Object[]getItems()Method to return all items in the items vector as an array of object.protected intgetItemWidth(int index)Method to return the width of the given item index with the current fontmetrics.intgetLineHeight()intgetPreferredHeight()Method to return the number of items multiplied by the font metrics heightintgetPreferredWidth()Method to return the preferred width, ie, size of the largest item plus 20.intgetScrollPosition(int direction)Returns the current position given the direction.intgetSelectedIndex()Method to return the position of the selected item of the Tree or -1 if the Tree has no selected index yet.NodegetSelectedItem()Method to return the selected item of the Tree or an empty String if no selection has been made.ControlhandleGeographicalFocusChangeKeys(KeyEvent ke)Used by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.intindexOf(java.lang.Object name)Method to return the index of the item specified by the name, or -1 if not found.protected voidinitImage()Method to load icons use for the tree.protected voidinitScrollBars()Method to initialize the vertical and horizontal scrollbars maximum.voidinitTree(Node root)Method to set the tree root node with the new root node.voidkeyPressed(KeyEvent e)A KEY_PRESS event was dispatched.voidnodeInserted(Node parent, Node child, int index)Method to notify the tree that a node has been added to the tree model and to repaint the tree to reflect the changes.voidnodeModified(Node node)Method to notify the tree that a node in the tree model has been modified (currently - only changing the user object)voidnodeRemoved(Node node)Method to notify the tree that a node has been removed from the tree model and to repaint the tree to reflect the changes, if necessaryprotected voidonBoundsChanged(boolean screenChanged)Method to recalculate the box size for the selected item if the control is resized by the main application .protected voidonColorsChanged(boolean colorsChanged)Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.voidonFontChanged()Called after a setFontvoidonPaint(Graphics g)Draws the border (if any).voidpenDown(PenEvent pe)A PEN_DOWN event was dispatched.voidpenDrag(DragEvent de)A PEN_DRAG event was dispatched.voidpenDragEnd(DragEvent e)A PEN_DRAG_END event was dispatched.voidpenDragStart(DragEvent e)A PEN_DRAG_START event was dispatched.voidpenUp(PenEvent pe)A PEN_UP event was dispatched.voidreload()Method to reload the tree.voidremove(int index)Method to remove the given index from the Tree items vector.voidremove(java.lang.Object item)Method to remove an Object from the Tree's items vector.voidremove(Control control)Do nothing.voidremoveAll()Method to empties this Tree, setting all elements of the array to null, so they can be garbage collected.booleanscrollContent(int dx, int dy, boolean fromFlick)Performs a relative move.voidsetBackColor(int c)Set the background color of this control.voidsetCursorColor(int color)Method to set the cursor color for this Tree.voidsetEnabled(boolean enabled)Method to enable this control if the specified enabled flag is true.voidsetIcon(int iconType, Image img)Method to set the icon of the tree based on the icon type.voidsetItemAt(int i, java.lang.Object s)Method to set the Object at the given Index, starting from 0.voidsetLineHeight(int k)Default line height.voidsetModel(TreeModel model)Method to set the tree model.voidsetScrollBarPolicy(int horiz, int vert)Method to set the scrollbar appearance.voidsetSelectedIndex(int i)Method to select the given index and scroll to it if necessary.voidsetSelectedItem(java.lang.Object name)Method to select the given name.intsize()Returns the number of items (Nodes)voidspecialkeyPressed(KeyEvent e)A SPECIAL_KEY_PRESS event was dispatched.voidunload()Method to clear the tree and release the tree model references.booleanwasScrolled()Returns true if the control was scrolled since last pen down-
Methods inherited from class totalcross.ui.Container
add, add, add, add, broadcastEvent, fillBackground, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderRadius, getBorderStyle, getChildren, getChildrenCount, getClientRect, getClientRect, getFirstChild, getInsets, incLastX, incLastY, initUI, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onRemove, onSwapFinished, paintChildren, resize, resizeHeight, resizeWidth, setBorderRadius, setBorderStyle, setFocusTraversable, setHighlighting, setInsets, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onEvent, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackForeColors, setDoEffect, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
SCROLLBAR_ALWAYS
public static final int SCROLLBAR_ALWAYS
- See Also:
- Constant Field Values
-
SCROLLBAR_AS_NEEDED
public static final int SCROLLBAR_AS_NEEDED
- See Also:
- Constant Field Values
-
SCROLLBAR_NEVER
public static final int SCROLLBAR_NEVER
- See Also:
- Constant Field Values
-
ICON_PLUS
public static final int ICON_PLUS
- See Also:
- Constant Field Values
-
ICON_MINUS
public static final int ICON_MINUS
- See Also:
- Constant Field Values
-
ICON_OPEN
public static final int ICON_OPEN
- See Also:
- Constant Field Values
-
ICON_CLOSE
public static final int ICON_CLOSE
- See Also:
- Constant Field Values
-
ICON_FILE
public static final int ICON_FILE
- See Also:
- Constant Field Values
-
multipleSelection
public boolean multipleSelection
Set to true to allow multiple selections using a Check drawn before the nodes.- Since:
- TotalCross 1.15
-
expandClickingOnText
public boolean expandClickingOnText
Set to false to only expand or collapse if you click on the +- buttons.- Since:
- TotalCross 1.2
-
useFullWidthOnSelection
public boolean useFullWidthOnSelection
If true, all Tree will have the selection bar drawn in the full width instead of the selected's text width- Since:
- TotalCross 1.27
-
flick
protected Flick flick
The Flick object listens and performs flick animations on PenUp events when appropriate.
-
imgPlus
protected Image imgPlus
-
imgMinus
protected Image imgMinus
-
imgOpen
protected Image imgOpen
-
imgClose
protected Image imgClose
-
imgFile
protected Image imgFile
-
vbar
protected ScrollBar vbar
-
hbar
protected ScrollBar hbar
-
model
protected TreeModel model
-
items
protected Vector items
-
offset
protected int offset
-
hsOffset
protected int hsOffset
-
selectedIndex
protected int selectedIndex
-
itemCount
protected int itemCount
-
hsCount
protected int hsCount
-
visibleItems
protected int visibleItems
-
btnX
protected int btnX
-
lineH
@Deprecated public int lineH
Deprecated.Use setLineHeight and getLineHeight
-
-
Constructor Detail
-
Tree
public Tree()
Constructs a new Tree based on an empty TreeModel.
-
Tree
public Tree(TreeModel model)
Constructs a new Tree based on the given parameters.- Parameters:
model- the TreeModel to be used
-
Tree
public Tree(TreeModel model, boolean showRoot)
Constructs a new Tree based on the given parameters.- Parameters:
model- the TreeModel to be usedshowRoot- if true, the root node is shown
-
-
Method Detail
-
setLineHeight
public void setLineHeight(int k)
Default line height.
-
getLineHeight
public int getLineHeight()
-
flickStarted
public boolean flickStarted()
Description copied from interface:ScrollableCalled when the flick animation is started.- Specified by:
flickStartedin interfaceScrollable
-
flickEnded
public void flickEnded(boolean atPenDown)
Description copied from interface:ScrollableCalled when the flick animation is ended.- Specified by:
flickEndedin interfaceScrollable- Parameters:
atPenDown- Flag indicating if the animation ended due to a pendown event.
-
canScrollContent
public boolean canScrollContent(int direction, java.lang.Object target)Description copied from interface:ScrollableChecks if there is room to flick this container in the given direction.- Specified by:
canScrollContentin interfaceScrollable- Parameters:
direction- The direction we want to flick given by one of the following constants:target- The target of the series of PEN events that triggered this flick attempt.- Returns:
- true if the container can flick in the indicated direction.
-
scrollContent
public boolean scrollContent(int dx, int dy, boolean fromFlick)Description copied from interface:ScrollablePerforms a relative move.- Specified by:
scrollContentin interfaceScrollable- Parameters:
dx- The relative amount of pixels to move in the X axis.dy- The relative amount of pixels to move in the Y axis.
-
getScrollPosition
public int getScrollPosition(int direction)
Description copied from interface:ScrollableReturns the current position given the direction. Used on page scrolls.- Specified by:
getScrollPositionin interfaceScrollable
-
getFlick
public Flick getFlick()
Description copied from interface:ScrollableReturns the current flick object.- Specified by:
getFlickin interfaceScrollable
-
wasScrolled
public boolean wasScrolled()
Description copied from interface:ScrollableReturns true if the control was scrolled since last pen down- Specified by:
wasScrolledin interfaceScrollable
-
dontShowFileAndFolderIcons
public void dontShowFileAndFolderIcons()
Call this method to hide the file and folder icons.
-
setModel
public void setModel(TreeModel model)
Method to set the tree model.- Parameters:
model- the tree model.
-
setScrollBarPolicy
public void setScrollBarPolicy(int horiz, int vert)Method to set the scrollbar appearance.- See Also:
SCROLLBAR_ALWAYS,SCROLLBAR_AS_NEEDED,SCROLLBAR_NEVER
-
initTree
public void initTree(Node root)
Method to set the tree root node with the new root node. If the new root node is null, the tree is unchanged.- Parameters:
root- the new tree root node.
-
onFontChanged
public void onFontChanged()
Description copied from class:ControlCalled after a setFont- Overrides:
onFontChangedin classControl
-
initScrollBars
protected void initScrollBars()
Method to initialize the vertical and horizontal scrollbars maximum.
-
initImage
protected void initImage()
Method to load icons use for the tree. You can change the icon by using the setIcon(int iconType, Filename imageFilename).
-
setIcon
public void setIcon(int iconType, Image img) throws ImageExceptionMethod to set the icon of the tree based on the icon type. Note: You should not change the plus and minus icons. You can set the open/close to null (setting one will null out the other).- Parameters:
iconType- one of the ICON_xxx constants.img- The image to be used.- Throws:
ImageException- See Also:
ICON_PLUS,ICON_MINUS,ICON_OPEN,ICON_CLOSE,ICON_FILE
-
getItemWidth
protected int getItemWidth(int index)
Method to return the width of the given item index with the current fontmetrics. Note: if you override this class you must implement this method.
-
removeAll
public void removeAll()
Method to empties this Tree, setting all elements of the array to null, so they can be garbage collected.
-
clear
public void clear()
Same as removeAll() method. Just more clearer method name
-
remove
public void remove(int index)
Method to remove the given index from the Tree items vector. This method will not remove the node from the original node.- Parameters:
index- the item index in the items vector.
-
remove
public void remove(java.lang.Object item)
Method to remove an Object from the Tree's items vector.- Parameters:
item- the Node to delete from the tree's item vector.
-
expand
public boolean expand(Node node)
Method to expand a collapsed node.- Parameters:
node- the collapse node to expand.- Returns:
- True if the item was expanded, false otherwise.
-
expandTo
public void expandTo(java.lang.String filePath)
Expands all nodes until the given path is reached
-
collapse
public boolean collapse(Node node)
Method to collapse an expanded node.- Parameters:
node- the expanded node to collapse.- Returns:
- True if the item was collapsed, false otherwise.
-
setItemAt
public void setItemAt(int i, java.lang.Object s)Method to set the Object at the given Index, starting from 0.- Parameters:
i- the indexs- the object to set.
-
getItemAt
public java.lang.Object getItemAt(int i)
Method to get the Object at the given Index. Returns an empty string in case of error.- Parameters:
i- the index.
-
getSelectedItem
public Node getSelectedItem()
Method to return the selected item of the Tree or an empty String if no selection has been made.- Returns:
- the selected object, or null is no selection has been made.
-
getSelectedIndex
public int getSelectedIndex()
Method to return the position of the selected item of the Tree or -1 if the Tree has no selected index yet.- Returns:
- the selected index or -1 if no selection has been made.
-
getItems
public java.lang.Object[] getItems()
Method to return all items in the items vector as an array of object. The objects are of the class Node.- Returns:
- all items in items vector as an array of Objects.
-
indexOf
public int indexOf(java.lang.Object name)
Method to return the index of the item specified by the name, or -1 if not found.- Parameters:
name- the object to find.- Returns:
- the index of the item specified by the name, or -1 if not found.
-
setSelectedItem
public void setSelectedItem(java.lang.Object name)
Method to select the given name. If the name is not found, the current selected item is not changed.- Parameters:
name- the object to select.- Since:
- SuperWaba 4.01
-
setSelectedIndex
public void setSelectedIndex(int i)
Method to select the given index and scroll to it if necessary. Note: select must be called only after the control has been added to the container and its rect has been set.- Parameters:
i- the index of the item.
-
size
public int size()
Returns the number of items (Nodes)
-
getPreferredWidth
public int getPreferredWidth()
Method to return the preferred width, ie, size of the largest item plus 20.- Overrides:
getPreferredWidthin classControl- Returns:
- the preferred width of this control.
-
getPreferredHeight
public int getPreferredHeight()
Method to return the number of items multiplied by the font metrics height- Overrides:
getPreferredHeightin classControl- Returns:
- the preferred height of this control.
-
find
protected void find(char c)
Method to search this Tree for an item with the first letter matching the given char. The search is made case insensitive. Note: if you override this class you must implement this method.
-
setEnabled
public void setEnabled(boolean enabled)
Method to enable this control if the specified enabled flag is true.- Overrides:
setEnabledin classContainer
-
setBackColor
public void setBackColor(int c)
Description copied from class:ControlSet the background color of this control.- Overrides:
setBackColorin classControl
-
onColorsChanged
protected void onColorsChanged(boolean colorsChanged)
Description copied from class:ControlCalled after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled- Overrides:
onColorsChangedin classContainer
-
onBoundsChanged
protected void onBoundsChanged(boolean screenChanged)
Method to recalculate the box size for the selected item if the control is resized by the main application .- Overrides:
onBoundsChangedin classControl- Parameters:
screenChanged- If the bounds were changed due to a screen change (rotation, collapse)
-
nodeRemoved
public void nodeRemoved(Node node)
Method to notify the tree that a node has been removed from the tree model and to repaint the tree to reflect the changes, if necessary- Parameters:
node- the node that has been removed from the tree model
-
nodeInserted
public void nodeInserted(Node parent, Node child, int index)
Method to notify the tree that a node has been added to the tree model and to repaint the tree to reflect the changes.- Parameters:
parent- the parent node of the new added nodechild- the new ly added nodeindex- the index of the new node
-
nodeModified
public void nodeModified(Node node)
Method to notify the tree that a node in the tree model has been modified (currently - only changing the user object)- Parameters:
node- the node that has been modified
-
penDrag
public void penDrag(DragEvent de)
Description copied from interface:PenListenerA PEN_DRAG event was dispatched.- Specified by:
penDragin interfacePenListener- See Also:
PenEvent
-
penDragEnd
public void penDragEnd(DragEvent e)
Description copied from interface:PenListenerA PEN_DRAG_END event was dispatched.- Specified by:
penDragEndin interfacePenListener- See Also:
PenEvent
-
penDragStart
public void penDragStart(DragEvent e)
Description copied from interface:PenListenerA PEN_DRAG_START event was dispatched.- Specified by:
penDragStartin interfacePenListener- See Also:
PenEvent
-
penDown
public void penDown(PenEvent pe)
Description copied from interface:PenListenerA PEN_DOWN event was dispatched.- Specified by:
penDownin interfacePenListener- See Also:
PenEvent
-
penUp
public void penUp(PenEvent pe)
Description copied from interface:PenListenerA PEN_UP event was dispatched.- Specified by:
penUpin interfacePenListener- See Also:
PenEvent
-
checkClicked
public void checkClicked(int sel)
-
controlPressed
public void controlPressed(ControlEvent e)
Description copied from interface:PressListenerA PRESSED event was dispatched.- Specified by:
controlPressedin interfacePressListener- See Also:
ControlEvent
-
actionkeyPressed
public void actionkeyPressed(KeyEvent e)
Description copied from interface:KeyListenerAn ACTION_KEY_PRESS event was dispatched.- Specified by:
actionkeyPressedin interfaceKeyListener- See Also:
KeyEvent
-
keyPressed
public void keyPressed(KeyEvent e)
Description copied from interface:KeyListenerA KEY_PRESS event was dispatched.- Specified by:
keyPressedin interfaceKeyListener- See Also:
KeyEvent
-
specialkeyPressed
public void specialkeyPressed(KeyEvent e)
Description copied from interface:KeyListenerA SPECIAL_KEY_PRESS event was dispatched.- Specified by:
specialkeyPressedin interfaceKeyListener- See Also:
KeyEvent
-
handleGeographicalFocusChangeKeys
public Control handleGeographicalFocusChangeKeys(KeyEvent ke)
Description copied from class:ControlUsed by the main event loop to give the currently focused control an opportunity to act directly on the KeyEvent.- Overrides:
handleGeographicalFocusChangeKeysin classControl- Parameters:
ke- The KeyEvent to be processed- Returns:
- The control that should get focus as a result of this KeyEvent. Null if this control did not handle the KeyEvent.
- See Also:
Settings.geographicalFocus
-
onPaint
public void onPaint(Graphics g)
Description copied from class:ContainerDraws the border (if any). If you override this method, be sure to callsuper.onPaint(g);, or the border will not be drawn.
-
drawNode
protected void drawNode(Graphics g, int index, int dx, int dy)
Method to draw the icons and node text
-
drawFileImage
protected void drawFileImage(Graphics g, Node node, int x, int y)
Allows the draw of customized file images.
-
drawConnector
protected void drawConnector(Graphics g, int index, int dx, int dy, Node node)
Method to draw the (line connector) angled line.
-
drawCursor
protected void drawCursor(Graphics g, int sel)
Method to draw the highlight box when user select a listbox's item.
-
setCursorColor
public void setCursorColor(int color)
Method to set the cursor color for this Tree. The default is equal to the background slightly darker.
-
reload
public void reload()
Method to reload the tree. Use this method when the tree model has made a drastic change.
-
unload
public void unload()
Method to clear the tree and release the tree model references.
-
getFocusableControls
public void getFocusableControls(Vector v)
Description copied from class:ContainerGet a list of child controls of this container which are focus candidates- Overrides:
getFocusableControlsin classContainer- Parameters:
v- A vector into which to add the focus candidates.
-
-