TreeVisualizer Methods
public BufferedImage renderTree(TreeNode tn)Returns the rendered image of the tree. This can be displayed in your application, printed, or saved to a file (perhaps by using writeImage()). TreeNode is an interface found under java.swing.tree.*. As long as your nodes implement the TreeNode interface, you will be able to use this method.
public void writeImageFile(RenderedImage ri, File f)A simple utility to write your rendered tree to a PNG file. (Note that RenderedImage is the superclass of BufferedImage.) Note: every "set" method has an complimentary "get" as well. public void setSide(int s)The side is the height and width, in pixels, of the entire image. This will determine how large of a file your image is. The default is 512.
public void setCircleDiminishFactor(double c)Set to a number between 0.0 and 1.0. Ideally, the number should be close to 1.0 and not less than 0.5. The default is 0.875.
public void setBranchStartWidth(double b)The initial thickness, in pixels, of branches. The default is 16.
public void setBranchDiminishFactor(double s)Property is similar to circleDiminshFactor, but determins successive branch thickness. The default is 0.6666.
public void setBkgndColor(Color c) public void setArenaColor(Color c) public void setBranchColor(Color c) public void setNodeColor(Color c)
public void setTreeBranchRenderer(TreeBranchRenderer ntbr)An object which extends the TreeBranchRenderer determines the color of the branches.
public void setTreeNodeRenderer(TreeNodeRenderer ntnr)An object which extends the TreeNodeRenderer determines the color of the nodes.
public void setRenderNodes(boolean r)If nodes are to be rendered or not.
public void setIgnorePastLevel(int i)Sets the tree level past which drawing will be ignored. Root level is 0. If this is set to a negative value, all levels will be drawn. |