Package dtree

Class DTPanel

All Implemented Interfaces:
MouseListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class DTPanel extends JPanel implements MouseListener
Class for a panel for a decision/regression tree display.
Since:
2004.05.10
See Also:
  • Constructor Details

    • DTPanel

      public DTPanel()
      Create a decision/regression tree panel.
      Since:
      2004.05.10 (Christian Borgelt)
    • DTPanel

      public DTPanel(DTree dtree)
      Create a decision/regression tree panel.
      Parameters:
      dtree - the decision tree to display
      Since:
      2004.05.10 (Christian Borgelt)
  • Method Details

    • getDTree

      public DTree getDTree()
      Get the decision/regression tree to display.
      Returns:
      the currently displayed decision/regression tree
      Since:
      2004.05.10 (Christian Borgelt)
    • setDTree

      public void setDTree(DTree dtree)
      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 node
      height - the height of a node
      horz - the horizontal distance between nodes
      vert - the vertical distance between nodes
      shadow - the width of the node shadow
      frame - the width of the frame around the tree
      Since:
      2004.05.10 (Christian Borgelt)
    • setFont

      public void setFont(Font font)
      Set the font for the node labels.
      Overrides:
      setFont in class JComponent
      Parameters:
      font - the font for the node labels
      Since:
      2004.05.26 (Christian Borgelt)
    • setFont

      public void setFont(Font font, boolean antia)
      Set the font for the node labels.
      Parameters:
      font - the font for the node labels
      antia - 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.
      Overrides:
      doLayout in class Container
      Since:
      2004.05.10 (Christian Borgelt)
    • 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

      public void paint(Graphics g)
      Repaint the whole panel.
      Overrides:
      paint in class JComponent
      Parameters:
      g - the graphics to use for painting
      Since:
      2004.05.10 (Christian Borgelt)
    • makeImage

      public BufferedImage 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

      public void mousePressed(MouseEvent e)
      Handle folding/unfolding of nodes with the mouse.
      Specified by:
      mousePressed in interface MouseListener
      Parameters:
      e - the event to process
      Since:
      2004.05.13 (Christian Borgelt)
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Needed for MouseListener interface.
      Specified by:
      mouseReleased in interface MouseListener
      Parameters:
      e - the event to process
      Since:
      2004.05.13 (Christian Borgelt)
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Needed for MouseListener interface.
      Specified by:
      mouseClicked in interface MouseListener
      Parameters:
      e - the event to process
      Since:
      2004.05.13 (Christian Borgelt)
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Needed for MouseListener interface.
      Specified by:
      mouseEntered in interface MouseListener
      Parameters:
      e - the event to process
      Since:
      2004.05.13 (Christian Borgelt)
    • mouseExited

      public void mouseExited(MouseEvent e)
      Needed for MouseListener interface.
      Specified by:
      mouseExited in interface MouseListener
      Parameters:
      e - the event to process
      Since:
      2004.05.13 (Christian Borgelt)