Package dtree

Class DTView

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, Accessible, RootPaneContainer, WindowConstants

public class DTView extends JFrame implements Runnable
Class for a decision and regression tree viewer.
Since:
2004.05.10
See Also:
  • Field Details

    • VERSION

      public static final String VERSION
      the version string
      See Also:
    • PROGRAM

      public static final int PROGRAM
      mode flag: the viewer is a stand-alone program
      See Also:
    • LOAD_ITEMS

      public static final int LOAD_ITEMS
      mode flag: add menu items for loading trees
      See Also:
    • SAVE_ITEMS

      public static final int SAVE_ITEMS
      mode flag: add menu items for saving trees
      See Also:
    • FILE_ITEMS

      public static final int FILE_ITEMS
      mode flag: add menu items for loading and saving trees
      See Also:
    • ALL_ITEMS

      public static final int ALL_ITEMS
      mode flag: add all menu items
      See Also:
  • Constructor Details

    • DTView

      public DTView(int mode)
      Create a decision and regression tree viewer.
      Parameters:
      mode - the mode flags
      Since:
      2004.05.10 (Christian Borgelt)
    • DTView

      public DTView(Component owner, int mode)
      Create a decision and regression tree viewer.
      Parameters:
      owner - the component that is to own this viewer
      mode - the mode flags
      Since:
      2004.05.10 (Christian Borgelt)
  • Method Details

    • run

      public void run()
      Create the user interface.

      Following the recommendations in the Java tutorial, the user interface is created in the "run" method, which is invoked from the event queue, in order to avoid problems with threads.

      Specified by:
      run in interface Runnable
      Since:
      2006.07.20 (Christian Borgelt)
    • setMessage

      public void setMessage(String msg)
      Set the message to display in the status line.
      Parameters:
      msg - the message to display in the status line
      Since:
      2007.03.12 (Christian Borgelt)
    • setDTree

      public void setDTree(DTree dtree)
      Set the decision or regression tree to display.
      Parameters:
      dtree - the decision or regression tree to display
      Since:
      2007.02.12 (Christian Borgelt)
    • getDTree

      public DTree getDTree()
      Set the currently displayed decision or regression tree
      Returns:
      the currently displayed decision or regression tree
      Since:
      2007.06.07 (Christian Borgelt)
    • loadDTree

      public boolean loadDTree(File file)
      Load the decision or regression tree to display.
      Parameters:
      file - the file to load the tree from
      Returns:
      whether the file was successfully loaded
      Since:
      2005.05.10 (Christian Borgelt)
    • saveDTree

      public boolean saveDTree(File file)
      Save the displayed decision or regression tree.
      Parameters:
      file - the file to save the tree to
      Returns:
      whether the file was successfully written
      Since:
      2005.05.10 (Christian Borgelt)
    • saveImage

      public boolean saveImage(File file)
      Save a PNG image of the panel.
      Parameters:
      file - the file to save the image to
      Returns:
      whether the file was successfully written
      Since:
      2007.02.07 (Christian Borgelt)
    • main

      public static void main(String[] args)
      Main function for command line invocation.
      Parameters:
      args - the command line arguments
      Since:
      2004.05.10 (Christian Borgelt)