Package dtree
Class DTPanel
- All Implemented Interfaces:
MouseListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
Class for a panel for a decision/regression tree display.
- Since:
- 2004.05.10
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doLayout()
Lay out the subtree, that is, compute node positions.void
fold
(boolean f) Fold/unfold all nodes of the decision/regression tree.getDTree()
Get the decision/regression tree to display.Create an image of the panel contents.void
Needed forMouseListener
interface.void
Needed forMouseListener
interface.void
Needed forMouseListener
interface.void
Handle folding/unfolding of nodes with the mouse.void
Needed forMouseListener
interface.void
Repaint the whole panel.void
setDirect
(boolean d) Set the edge drawing mode.void
Set the decision/regression tree to display.void
setEdges
(int thick) Set the thickness of the connecting lines (in pixels).void
setEdges
(int thick, boolean antia) Set the thickness of the connecting lines (in pixels).void
Set the font for the node labels.void
Set the font for the node labels.void
setMode
(int mode) Set the layout mode (horizontal vs.void
setParams
(int width, int height, int horz, int vert, int shadow, int frame) Set the layout parameters.void
Show detailed information about a decision tree node.void
Update the color(s) for the target values.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
DTPanel
public DTPanel()Create a decision/regression tree panel.- Since:
- 2004.05.10 (Christian Borgelt)
-
DTPanel
Create a decision/regression tree panel.- Parameters:
dtree
- the decision tree to display- Since:
- 2004.05.10 (Christian Borgelt)
-
-
Method Details
-
getDTree
Get the decision/regression tree to display.- Returns:
- the currently displayed decision/regression tree
- Since:
- 2004.05.10 (Christian Borgelt)
-
setDTree
Set the decision/regression tree to display.- Parameters:
dtree
- the decision/regression tree to display- Since:
- 2004.05.10 (Christian Borgelt)
-
updateColors
public void updateColors()Update the color(s) for the target values.- Since:
- 2007.02.23 (Christian Borgelt)
-
setMode
public void setMode(int mode) Set the layout mode (horizontal vs. vertical etc).- Parameters:
mode
- the layout mode- Since:
- 2004.05.10 (Christian Borgelt)
-
setEdges
public void setEdges(int thick) Set the thickness of the connecting lines (in pixels).- Parameters:
thick
- the line thickness (in pixels)- Since:
- 2015.12.11 (Christian Borgelt)
-
setEdges
public void setEdges(int thick, boolean antia) Set the thickness of the connecting lines (in pixels).- Parameters:
thick
- the line thickness (in pixels)antia
- whether to apply anti-aliasing to the edges- Since:
- 2015.12.11 (Christian Borgelt)
-
setDirect
public void setDirect(boolean d) Set the edge drawing mode.- Parameters:
d
- whether to draw edges directly- Since:
- 2004.05.10 (Christian Borgelt)
-
setParams
public void setParams(int width, int height, int horz, int vert, int shadow, int frame) Set the layout parameters.- Parameters:
width
- the width of a nodeheight
- the height of a nodehorz
- the horizontal distance between nodesvert
- the vertical distance between nodesshadow
- the width of the node shadowframe
- the width of the frame around the tree- Since:
- 2004.05.10 (Christian Borgelt)
-
setFont
Set the font for the node labels.- Overrides:
setFont
in classJComponent
- Parameters:
font
- the font for the node labels- Since:
- 2004.05.26 (Christian Borgelt)
-
setFont
Set the font for the node labels.- Parameters:
font
- the font for the node labelsantia
- whether to apply anti-aliasing to the labels- Since:
- 2004.05.26 (Christian Borgelt)
-
doLayout
public void doLayout()Lay out the subtree, that is, compute node positions. -
fold
public void fold(boolean f) Fold/unfold all nodes of the decision/regression tree.- Parameters:
f
- whether to fold all nodes- Since:
- 2004.05.16 (Christian Borgelt)
-
paint
Repaint the whole panel.- Overrides:
paint
in classJComponent
- Parameters:
g
- the graphics to use for painting- Since:
- 2004.05.10 (Christian Borgelt)
-
makeImage
Create an image of the panel contents.- Returns:
- an image of the panel contents
- Since:
- 2004.09.13 (Christian Borgelt)
-
showDetails
public void showDetails()Show detailed information about a decision tree node.- Since:
- 2015.11.13 (Christian Borgelt)
-
mousePressed
Handle folding/unfolding of nodes with the mouse.- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
- the event to process- Since:
- 2004.05.13 (Christian Borgelt)
-
mouseReleased
Needed forMouseListener
interface.- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
- the event to process- Since:
- 2004.05.13 (Christian Borgelt)
-
mouseClicked
Needed forMouseListener
interface.- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
e
- the event to process- Since:
- 2004.05.13 (Christian Borgelt)
-
mouseEntered
Needed forMouseListener
interface.- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
e
- the event to process- Since:
- 2004.05.13 (Christian Borgelt)
-
mouseExited
Needed forMouseListener
interface.- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
e
- the event to process- Since:
- 2004.05.13 (Christian Borgelt)
-