question: public TreeVisualizer ( TreeDisplayListener tdl , Node n , NodePlace p ) { super ( ) ; initialize ( ) ; if ( m_ShowBorder ) { setBorder ( BorderFactory . createTitledBorder ( "Tree View" ) ) ; } m_listener = tdl ; m_topNode = n ; m_placer = p ; m_placer . place ( m_topNode ) ; m_viewPos = new Dimension ( 0 , 0 ) ; m_viewSize = new Dimension ( 800 , 600 ) ; m_nViewPos = new Dimension ( 0 , 0 ) ; m_nViewSize = new Dimension ( 800 , 600 ) ; m_scaling = 0 ; m_numNodes = Node . getCount ( m_topNode , 0 ) ; m_numLevels = Node . getHeight ( m_topNode , 0 ) ; m_nodes = new NodeInfo [ m_numNodes ] ; m_edges = new EdgeInfo [ m_numNodes - 1 ] ; arrayFill ( m_topNode , m_nodes , m_edges ) ; changeFontSize ( 12 ) ; m_mouseState = 0 ; m_oldMousePos = new Dimension ( 0 , 0 ) ; m_newMousePos = new Dimension ( 0 , 0 ) ; m_frameLimiter = new Timer ( 120 , this ) ; m_winMenu = new JPopupMenu ( ) ; m_topN = new JMenuItem ( "Center on Top Node" ) ; m_topN . setActionCommand ( "Center on Top Node" ) ; m_fitToScreen = new JMenuItem ( "Fit to Screen" ) ; m_fitToScreen . setActionCommand ( "Fit to Screen" ) ; m_selectFont = new JMenu ( "Select Font" ) ; m_selectFont . setActionCommand ( "Select Font" ) ; m_autoScale = new JMenuItem ( "Auto Scale" ) ; m_autoScale . setActionCommand ( "Auto Scale" ) ; m_selectFontGroup = new ButtonGroup ( ) ; m_accept = new JMenuItem ( "Accept The Tree" ) ; m_accept . setActionCommand ( "Accept The Tree" ) ; m_winMenu . add ( m_topN ) ; m_winMenu . addSeparator ( ) ; m_winMenu . add ( m_fitToScreen ) ; m_winMenu . add ( m_autoScale ) ; m_winMenu . addSeparator ( ) ; m_winMenu . addSeparator ( ) ; m_winMenu . add ( m_selectFont ) ; m_winMenu . addSeparator ( ) ; if ( m_listener != null ) { m_winMenu . add ( m_accept ) ; } m_topN . addActionListener ( this ) ; m_fitToScreen . addActionListener ( this ) ; m_autoScale . addActionListener ( this ) ; m_accept . addActionListener ( this ) ; m_size24 = new JRadioButtonMenuItem ( "Size 24" , false ) ; m_size22 = new JRadioButtonMenuItem ( "Size 22" , false ) ; m_size20 = new JRadioButtonMenuItem ( "Size 20" , false ) ; m_size18 = new JRadioButtonMenuItem ( "Size 18" , false ) ; m_size16 = new JRadioButtonMenuItem ( "Size 16" , false ) ; m_size14 = new JRadioButtonMenuItem ( "Size 14" , false ) ; m_size12 = new JRadioButtonMenuItem ( "Size 12" , true ) ; m_size10 = new JRadioButtonMenuItem ( "Size 10" , false ) ; m_size8 = new JRadioButtonMenuItem ( "Size 8" , false ) ; m_size6 = new JRadioButtonMenuItem ( "Size 6" , false ) ; m_size4 = new JRadioButtonMenuItem ( "Size 4" , false ) ; m_size2 = new JRadioButtonMenuItem ( "Size 2" , false ) ; m_size1 = new JRadioButtonMenuItem ( "Size 1" , false ) ; m_size24 . setActionCommand ( "Size 24" ) ; m_size22 . setActionCommand ( "Size 22" ) ; m_size20 . setActionCommand ( "Size 20" ) ; m_size18 . setActionCommand ( "Size 18" ) ; m_size16 . setActionCommand ( "Size 16" ) ; m_size14 . setActionCommand ( "Size 14" ) ; m_size12 . setActionCommand ( "Size 12" ) ; m_size10 . setActionCommand ( "Size 10" ) ; m_size8 . setActionCommand ( "Size 8" ) ; m_size6 . setActionCommand ( "Size 6" ) ; m_size4 . setActionCommand ( "Size 4" ) ; m_size2 . setActionCommand ( "Size 2" ) ; m_size1 . setActionCommand ( "Size 1" ) ; m_selectFontGroup . add ( m_size24 ) ; m_selectFontGroup . add ( m_size22 ) ; m_selectFontGroup . add ( m_size20 ) ; m_selectFontGroup . add ( m_size18 ) ; m_selectFontGroup . add ( m_size16 ) ; m_selectFontGroup . add ( m_size14 ) ; m_selectFontGroup . add ( m_size12 ) ; m_selectFontGroup . add ( m_size10 ) ; m_selectFontGroup . add ( m_size8 ) ; m_selectFontGroup . add ( m_size6 ) ; m_selectFontGroup . add ( m_size4 ) ; m_selectFontGroup . add ( m_size2 ) ; m_selectFontGroup . add ( m_size1 ) ; m_selectFont . add ( m_size24 ) ; m_selectFont . add ( m_size22 ) ; m_selectFont . add ( m_size20 ) ; m_selectFont . add ( m_size18 ) ; m_selectFont . add ( m_size16 ) ; m_selectFont . add ( m_size14 ) ; m_selectFont . add ( m_size12 ) ; m_selectFont . add ( m_size10 ) ; m_selectFont . add ( m_size8 ) ; m_selectFont . add ( m_size6 ) ; m_selectFont . add ( m_size4 ) ; m_selectFont . add ( m_size2 ) ; m_selectFont . add ( m_size1 ) ; m_size24 . addItemListener ( this ) ; m_size22 . addItemListener ( this ) ; m_size20 . addItemListener ( this ) ; m_size18 . addItemListener ( this ) ; m_size16 . addItemListener ( this ) ; m_size14 . addItemListener ( this ) ; m_size12 . addItemListener ( this ) ; m_size10 . addItemListener ( this ) ; m_size8 . addItemListener ( this ) ; m_size6 . addItemListener ( this ) ; m_size4 . addItemListener ( this ) ; m_size2 . addItemListener ( this ) ; m_size1 . addItemListener ( this ) ; m_nodeMenu = new JPopupMenu ( ) ; m_visualise = new JMenuItem ( "Visualize The Node" ) ; m_visualise . setActionCommand ( "Visualize The Node" ) ; m_visualise . addActionListener ( this ) ; m_nodeMenu . add ( m_visualise ) ; if ( m_listener != null ) { m_remChildren = new JMenuItem ( "Remove Child Nodes" ) ; m_remChildren . setActionCommand ( "Remove Child Nodes" ) ; m_remChildren . addActionListener ( this ) ; m_nodeMenu . add ( m_remChildren ) ; m_classifyChild = new JMenuItem ( "Use Classifier..." ) ; m_classifyChild . setActionCommand ( "classify_child" ) ; m_classifyChild . addActionListener ( this ) ; m_nodeMenu . add ( m_classifyChild ) ; m_sendInstances = new JMenuItem ( "Add Instances To Viewer" ) ; m_sendInstances . setActionCommand ( "send_instances" ) ; m_sendInstances . addActionListener ( this ) ; m_nodeMenu . add ( m_sendInstances ) ; } m_focusNode = - 1 ; m_highlightNode = - 1 ; addMouseMotionListener ( this ) ; addMouseListener ( this ) ; m_frameLimiter . setRepeats ( false ) ; m_frameLimiter . start ( ) ; }
target:  Constructs Displayer with the specified Node as the top of the tree, and uses the NodePlacer to place the Nodes.