weka.gui.treevisualizer
Class TreeVisualizer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byweka.gui.treevisualizer.TreeVisualizer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class TreeVisualizer
extends javax.swing.JPanel
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener, java.awt.event.ActionListener, java.awt.event.ItemListener

Class for displaying a Node structure in Swing.

To work this class simply create an instance of it.

Assign it to a window or other such object.

Resize it to the desired size.

When using the Displayer hold the left mouse button to drag the tree around.

Click the left mouse button with ctrl to shrink the size of the tree by half.

Click and drag with the left mouse button and shift to draw a box, when the left mouse button is released the contents of the box will be magnified to fill the screen.

Click the right mouse button to bring up a menu.

Most options are self explanatory.

Select Auto Scale to set the tree to it's optimal display size.

Version:
$Revision: 1.7 $
Author:
Malcolm Ware (mfw4@cs.waikato.ac.nz)
See Also:
Serialized Form

Nested Class Summary
private  class TreeVisualizer.EdgeInfo
          Internal Class for containing display information about an Edge.
private  class TreeVisualizer.NodeInfo
          Internal Class for containing display information about a Node.
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.JMenuItem m_accept
          An option on the win menu.
private  javax.swing.JMenuItem m_addChildren
          An add children to Node choice, This is only available if the tree display has a treedisplay listerner added to it.
private  javax.swing.JMenuItem m_autoScale
          An option on the win_menu
private  javax.swing.JRadioButton m_caseSen
           
private  javax.swing.JMenuItem m_classifyChild
          Use this to have J48 classify this node.
private  boolean m_clickAvailable
          A variable used to determine for the clicked method if any other mouse state has already taken place.
private  java.awt.Font m_currentFont
          The font used to display the tree.
private  TreeVisualizer.EdgeInfo[] m_edges
          An array with the Edges sorted into it and display information about the Edges.
private  javax.swing.JMenuItem m_fitToScreen
          An option on the win_menu
private  int m_focusNode
          The subscript for the currently selected node (this is an internal thing, so the user is unaware of this).
private  java.awt.FontMetrics m_fontSize
          The size information for the current font.
private  javax.swing.Timer m_frameLimiter
          A timer to keep the frame rate constant.
private  int m_highlightNode
          The Node the user is currently focused on , this is similar to focus node except that it is used by other classes rather than this one.
private  TreeDisplayListener m_listener
           
private  int m_mouseState
          Describes the action the user is performing.
private  java.awt.Dimension m_newMousePos
          A variable used to tag the most current point of a user action.
private  javax.swing.JPopupMenu m_nodeMenu
          A right or middle click popup menu for nodes.
private  TreeVisualizer.NodeInfo[] m_nodes
          An array with the Nodes sorted into it and display information about the Nodes.
private  int m_numLevels
          The number of levels in the tree.
private  int m_numNodes
          The number of Nodes in the tree.
private  java.awt.Dimension m_nViewPos
          A variable used to remember the desired view pos.
private  java.awt.Dimension m_nViewSize
          A variable used to remember the desired tree size.
private  java.awt.Dimension m_oldMousePos
          A variable used to tag the start pos of a user action.
private  NodePlace m_placer
          The placement algorithm for the Node structure.
private  javax.swing.JMenuItem m_remChildren
          Similar to add children but now it removes children.
private  int m_scaling
          The number of frames left to calculate.
private  javax.swing.JTextField m_searchString
           
private  javax.swing.JDialog m_searchWin
           
private  javax.swing.JMenu m_selectFont
          A ub group on the win_menu
private  javax.swing.ButtonGroup m_selectFontGroup
          A grouping for the font choices
private  javax.swing.JMenuItem m_sendInstances
          Use this to dump the instances from this node to the vis panel.
private  javax.swing.JRadioButtonMenuItem m_size1
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size10
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size12
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size14
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size16
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size18
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size2
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size20
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size22
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size24
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size4
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size6
          A font choice.
private  javax.swing.JRadioButtonMenuItem m_size8
          A font choice.
private  javax.swing.JMenuItem m_topN
          An option on the win_menu
private  Node m_topNode
          The top Node.
private  java.awt.Dimension m_viewPos
          The postion of the view relative to the tree.
private  java.awt.Dimension m_viewSize
          The size of the tree in pixels.
private  javax.swing.JMenuItem m_visualise
          A visualize choice for the node, may not be available.
private  javax.swing.JPopupMenu m_winMenu
          A right (or middle) click popup menu.
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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.Container
 
Fields inherited from class java.awt.Component
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
TreeVisualizer(TreeDisplayListener tdl, Node n, NodePlace p)
          Constructs Displayer with the specified Node as the top of the tree, and uses the NodePlacer to place the Nodes.
TreeVisualizer(TreeDisplayListener tdl, java.lang.String dot, NodePlace p)
          Constructs Displayer to display a tree provided in a dot format.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Performs the action associated with the ActionEvent.
private  void animateScaling(java.awt.Dimension n_pos, java.awt.Dimension n_size, int frames)
          This will increment the size and position of the tree towards the desired size and position a little (depending on the value of frames) everytime it is called.
private  void arrayFill(Node t, TreeVisualizer.NodeInfo[] l, TreeVisualizer.EdgeInfo[] k)
          This will fill two arrays with the Nodes and Edges from the tree into a particular order.
private  void autoScale()
          This Calculates the minimum size of the tree which will prevent any text overlapping and make it readable, and then set the size of the tree to this.
private  void calcScreenCoords(int n)
          Converts the internal coordinates of the node found from n and converts them to the actual screen coordinates.
private  void changeFontSize(int s)
          This will change the font size for displaying the tree to the one specified.
private  void drawLine(int e, java.awt.Graphics g)
          Determines the attributes of the edge and draws it.
private  void drawNode(int n, java.awt.Graphics g)
          Determines the attributes of the node and draws it.
private  void drawText(int x1, int y1, int s, boolean e_or_n, java.awt.Graphics g)
          Draws the text for either an Edge or a Node.
 void fitToScreen()
          Fits the tree to the current screen size.
private  void getScreenFit(java.awt.Dimension np, java.awt.Dimension ns)
          Calculates the dimensions needed to fit the entire tree into view.
 void itemStateChanged(java.awt.event.ItemEvent e)
          Performs the action associated with the ItemEvent.
static void main(java.lang.String[] args)
          Main method for testing this class.
 void mouseClicked(java.awt.event.MouseEvent e)
          Does nothing.
 void mouseDragged(java.awt.event.MouseEvent e)
          Performs intermediate updates to what the user wishes to do.
 void mouseEntered(java.awt.event.MouseEvent e)
          Does nothing.
 void mouseExited(java.awt.event.MouseEvent e)
          Does nothing.
private  boolean mouseInBounds(java.awt.event.MouseEvent e)
          Checks to see if the coordinates of the mouse lie on this JPanel.
 void mouseMoved(java.awt.event.MouseEvent e)
          Does nothing.
 void mousePressed(java.awt.event.MouseEvent e)
          Determines what action the user wants to perform.
 void mouseReleased(java.awt.event.MouseEvent e)
          Performs the final stages of what the user wants to perform.
 void paintComponent(java.awt.Graphics g)
          Updates the screen contents.
private  void painter(java.awt.Graphics g)
          Draws the tree to the graphics context
 void setHighlight(java.lang.String id)
          Set the highlight for the node with the given id
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_placer

private NodePlace m_placer
The placement algorithm for the Node structure.


m_topNode

private Node m_topNode
The top Node.


m_viewPos

private java.awt.Dimension m_viewPos
The postion of the view relative to the tree.


m_viewSize

private java.awt.Dimension m_viewSize
The size of the tree in pixels.


m_currentFont

private java.awt.Font m_currentFont
The font used to display the tree.


m_fontSize

private java.awt.FontMetrics m_fontSize
The size information for the current font.


m_numNodes

private int m_numNodes
The number of Nodes in the tree.


m_numLevels

private int m_numLevels
The number of levels in the tree.


m_nodes

private TreeVisualizer.NodeInfo[] m_nodes
An array with the Nodes sorted into it and display information about the Nodes.


m_edges

private TreeVisualizer.EdgeInfo[] m_edges
An array with the Edges sorted into it and display information about the Edges.


m_frameLimiter

private javax.swing.Timer m_frameLimiter
A timer to keep the frame rate constant.


m_mouseState

private int m_mouseState
Describes the action the user is performing.


m_oldMousePos

private java.awt.Dimension m_oldMousePos
A variable used to tag the start pos of a user action.


m_newMousePos

private java.awt.Dimension m_newMousePos
A variable used to tag the most current point of a user action.


m_clickAvailable

private boolean m_clickAvailable
A variable used to determine for the clicked method if any other mouse state has already taken place.


m_nViewPos

private java.awt.Dimension m_nViewPos
A variable used to remember the desired view pos.


m_nViewSize

private java.awt.Dimension m_nViewSize
A variable used to remember the desired tree size.


m_scaling

private int m_scaling
The number of frames left to calculate.


m_winMenu

private javax.swing.JPopupMenu m_winMenu
A right (or middle) click popup menu.


m_topN

private javax.swing.JMenuItem m_topN
An option on the win_menu


m_fitToScreen

private javax.swing.JMenuItem m_fitToScreen
An option on the win_menu


m_autoScale

private javax.swing.JMenuItem m_autoScale
An option on the win_menu


m_selectFont

private javax.swing.JMenu m_selectFont
A ub group on the win_menu


m_selectFontGroup

private javax.swing.ButtonGroup m_selectFontGroup
A grouping for the font choices


m_size24

private javax.swing.JRadioButtonMenuItem m_size24
A font choice.


m_size22

private javax.swing.JRadioButtonMenuItem m_size22
A font choice.


m_size20

private javax.swing.JRadioButtonMenuItem m_size20
A font choice.


m_size18

private javax.swing.JRadioButtonMenuItem m_size18
A font choice.


m_size16

private javax.swing.JRadioButtonMenuItem m_size16
A font choice.


m_size14

private javax.swing.JRadioButtonMenuItem m_size14
A font choice.


m_size12

private javax.swing.JRadioButtonMenuItem m_size12
A font choice.


m_size10

private javax.swing.JRadioButtonMenuItem m_size10
A font choice.


m_size8

private javax.swing.JRadioButtonMenuItem m_size8
A font choice.


m_size6

private javax.swing.JRadioButtonMenuItem m_size6
A font choice.


m_size4

private javax.swing.JRadioButtonMenuItem m_size4
A font choice.


m_size2

private javax.swing.JRadioButtonMenuItem m_size2
A font choice.


m_size1

private javax.swing.JRadioButtonMenuItem m_size1
A font choice.


m_accept

private javax.swing.JMenuItem m_accept
An option on the win menu.


m_nodeMenu

private javax.swing.JPopupMenu m_nodeMenu
A right or middle click popup menu for nodes.


m_visualise

private javax.swing.JMenuItem m_visualise
A visualize choice for the node, may not be available.


m_addChildren

private javax.swing.JMenuItem m_addChildren
An add children to Node choice, This is only available if the tree display has a treedisplay listerner added to it.


m_remChildren

private javax.swing.JMenuItem m_remChildren
Similar to add children but now it removes children.


m_classifyChild

private javax.swing.JMenuItem m_classifyChild
Use this to have J48 classify this node.


m_sendInstances

private javax.swing.JMenuItem m_sendInstances
Use this to dump the instances from this node to the vis panel.


m_focusNode

private int m_focusNode
The subscript for the currently selected node (this is an internal thing, so the user is unaware of this).


m_highlightNode

private int m_highlightNode
The Node the user is currently focused on , this is similar to focus node except that it is used by other classes rather than this one.


m_listener

private TreeDisplayListener m_listener

m_searchString

private javax.swing.JTextField m_searchString

m_searchWin

private javax.swing.JDialog m_searchWin

m_caseSen

private javax.swing.JRadioButton m_caseSen
Constructor Detail

TreeVisualizer

public TreeVisualizer(TreeDisplayListener tdl,
                      java.lang.String dot,
                      NodePlace p)
Constructs Displayer to display a tree provided in a dot format. Uses the NodePlacer to place the Nodes.

Parameters:
tdl - listener
dot - string containing the dot representation of the tree to display
p - the algorithm to be used to position the nodes.

TreeVisualizer

public TreeVisualizer(TreeDisplayListener tdl,
                      Node n,
                      NodePlace p)
Constructs Displayer with the specified Node as the top of the tree, and uses the NodePlacer to place the Nodes.

Parameters:
tdl - listener.
n - the top Node of the tree to be displayed.
p - the algorithm to be used to position the nodes.
Method Detail

fitToScreen

public void fitToScreen()
Fits the tree to the current screen size. Call this after window has been created to get the entrire tree to be in view upon launch.


getScreenFit

private void getScreenFit(java.awt.Dimension np,
                          java.awt.Dimension ns)
Calculates the dimensions needed to fit the entire tree into view.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Performs the action associated with the ActionEvent.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the action event.

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Performs the action associated with the ItemEvent.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
e - the item event.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Does nothing.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the mouse event.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Determines what action the user wants to perform.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - the mouse event.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Performs the final stages of what the user wants to perform.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - the mouse event.

mouseInBounds

private boolean mouseInBounds(java.awt.event.MouseEvent e)
Checks to see if the coordinates of the mouse lie on this JPanel.

Parameters:
e - the mouse event.
Returns:
true if the mouse lies on this JPanel.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Performs intermediate updates to what the user wishes to do.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event.

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Does nothing.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Does nothing.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - the mouse event.

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Does nothing.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - the mouse event.

setHighlight

public void setHighlight(java.lang.String id)
Set the highlight for the node with the given id

Parameters:
id - the id of the node to set the highlight for

paintComponent

public void paintComponent(java.awt.Graphics g)
Updates the screen contents.

Parameters:
g - the drawing surface.

painter

private void painter(java.awt.Graphics g)
Draws the tree to the graphics context

Parameters:
g - the drawing surface.

drawNode

private void drawNode(int n,
                      java.awt.Graphics g)
Determines the attributes of the node and draws it.

Parameters:
n - A subscript identifying the node in nodes array
g - The drawing surface

drawLine

private void drawLine(int e,
                      java.awt.Graphics g)
Determines the attributes of the edge and draws it.

Parameters:
e - A subscript identifying the edge in edges array.
g - The drawing surface.

drawText

private void drawText(int x1,
                      int y1,
                      int s,
                      boolean e_or_n,
                      java.awt.Graphics g)
Draws the text for either an Edge or a Node.

Parameters:
x1 - the left side of the text area.
y1 - the top of the text area.
s - A subscript identifying either a Node or Edge.
e_or_n - Distinguishes whether it is a node or edge.
g - The drawing surface.

calcScreenCoords

private void calcScreenCoords(int n)
Converts the internal coordinates of the node found from n and converts them to the actual screen coordinates.

Parameters:
n - A subscript identifying the Node.

autoScale

private void autoScale()
This Calculates the minimum size of the tree which will prevent any text overlapping and make it readable, and then set the size of the tree to this.


animateScaling

private void animateScaling(java.awt.Dimension n_pos,
                            java.awt.Dimension n_size,
                            int frames)
This will increment the size and position of the tree towards the desired size and position a little (depending on the value of frames) everytime it is called.

Parameters:
n_pos - The final position of the tree wanted.
n_size - The final size of the tree wanted.
frames - The number of frames that shall occur before the final size and pos is reached.

changeFontSize

private void changeFontSize(int s)
This will change the font size for displaying the tree to the one specified.

Parameters:
s - The new pointsize of the font.

arrayFill

private void arrayFill(Node t,
                       TreeVisualizer.NodeInfo[] l,
                       TreeVisualizer.EdgeInfo[] k)
This will fill two arrays with the Nodes and Edges from the tree into a particular order.

Parameters:
t - The top Node of the tree.
l - An array that has already been allocated, to be filled.
k - An array that has already been allocated, to be filled.

main

public static void main(java.lang.String[] args)
Main method for testing this class.

Parameters:
args - first argument should be the name of a file that contains a tree discription in dot format.