Package weka.gui.graphvisualizer

Examples of weka.gui.graphvisualizer.GraphVisualizer$GraphPanel


  protected void visualizeBayesNet(String XMLBIF, String graphName) {
    final javax.swing.JFrame jf =
      new javax.swing.JFrame("Weka Classifier Graph Visualizer: "+graphName);
    jf.setSize(500,400);
    jf.getContentPane().setLayout(new BorderLayout());
    GraphVisualizer gv = new GraphVisualizer();
    try { gv.readBIF(XMLBIF);
    }
    catch(BIFFormatException be) { System.err.println("unable to visualize BayesNet"); be.printStackTrace(); }
    gv.layoutGraph();

    jf.getContentPane().add(gv, BorderLayout.CENTER);
    jf.addWindowListener(new java.awt.event.WindowAdapter() {
  public void windowClosing(java.awt.event.WindowEvent e) {
    jf.dispose();
View Full Code Here


   * @param bayesnet 
   */
  public void runBayesNetGUI(BayesNet bayesnet) {
     
      // display graph
      GraphVisualizer gv = new GraphVisualizer();
      try {
      gv.readBIF(bayesnet.graph());
    } catch (BIFFormatException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
       
      JFrame jf = new JFrame("BayesNet graph");
      jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      jf.setSize(800, 600);
      jf.getContentPane().setLayout(new BorderLayout());
      jf.getContentPane().add(gv, BorderLayout.CENTER);
      jf.setVisible(true);
      gv.layoutGraph();
  }
View Full Code Here

    if(grphType == Drawable.BayesNet) {
      final javax.swing.JFrame jf =
  new javax.swing.JFrame(Messages.getInstance().getString("GraphViewer_DoPopup_Jf_JFrame_Text_Second") + name);
      jf.setSize(500,400);
      jf.getContentPane().setLayout(new BorderLayout());
      GraphVisualizer gv =
  new GraphVisualizer();
      try {
  gv.readBIF(grphString);
      }
      catch (BIFFormatException be) {
  System.err.println(Messages.getInstance().getString("GraphViewer_DoPopup_Error_Text")); be.printStackTrace();
      }
      gv.layoutGraph();
      jf.getContentPane().add(gv, BorderLayout.CENTER);
      jf.addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent e) {
            jf.dispose();
    }
View Full Code Here

        if (retVal != JFileChooser.APPROVE_OPTION)
          return;

        // build graph
        String filename = m_FileChooserGraphVisualizer.getSelectedFile().getAbsolutePath();
        GraphVisualizer panel = new GraphVisualizer();
        try{
          if (    filename.toLowerCase().endsWith(".xml")
              || filename.toLowerCase().endsWith(".bif") ) {
            panel.readBIF(new FileInputStream(filename));
          }
          else {
            panel.readDOT(new FileReader(filename));
          }
        }
        catch (Exception ex) {
          ex.printStackTrace();
          JOptionPane.showMessageDialog(
View Full Code Here

  protected void visualizeBayesNet(String XMLBIF, String graphName) {
    final javax.swing.JFrame jf =
      new javax.swing.JFrame(Messages.getInstance().getString("ClassifierPanel_VisualizeBayesNet_JF_JFrame_Text") + graphName);
    jf.setSize(500,400);
    jf.getContentPane().setLayout(new BorderLayout());
    GraphVisualizer gv = new GraphVisualizer();
    try { gv.readBIF(XMLBIF);
    }
    catch(BIFFormatException be) { System.err.println(Messages.getInstance().getString("ClassifierPanel_VisualizeBayesNet_Error_Text")); be.printStackTrace(); }
    gv.layoutGraph();

    jf.getContentPane().add(gv, BorderLayout.CENTER);
    jf.addWindowListener(new java.awt.event.WindowAdapter() {
  public void windowClosing(java.awt.event.WindowEvent e) {
    jf.dispose();
View Full Code Here

    if (retVal != JFileChooser.APPROVE_OPTION)
      return;

    // build graph
    String filename = m_FileChooserGraphVisualizer.getSelectedFile().getAbsolutePath();
    GraphVisualizer panel = new GraphVisualizer();
    try{
      if (    filename.toLowerCase().endsWith(".xml")
    || filename.toLowerCase().endsWith(".bif") ) {
        panel.readBIF(new FileInputStream(filename));
      }
      else {
        panel.readDOT(new FileReader(filename));
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(
View Full Code Here

  if (retVal != JFileChooser.APPROVE_OPTION)
    return;

  // build graph
  String filename = m_FileChooserGraphVisualizer.getSelectedFile().getAbsolutePath();
  GraphVisualizer panel = new GraphVisualizer();
  try{
    if (    filename.toLowerCase().endsWith(".xml")
        || filename.toLowerCase().endsWith(".bif") ) {
      panel.readBIF(new FileInputStream(filename));
    }
    else {
      panel.readDOT(new FileReader(filename));
    }
  }
  catch (Exception ex) {
    ex.printStackTrace();
    JOptionPane.showMessageDialog(
        m_Self, "Error loading file '" + filename + "':\n" + ex.getMessage());
    return;
  }

  // create frame
  final JFrame frame = new JFrame("GraphVisualizer - " + filename);
  frame.setIconImage(m_Icon);
  frame.getContentPane().setLayout(new BorderLayout());
  frame.getContentPane().add(panel, BorderLayout.CENTER);
  frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
      m_GraphVisualizers.remove(frame);
      frame.dispose();
      checkExit();
    }
  });
  frame.pack();
  frame.setSize(800, 600);
  frame.setVisible(true);
  m_GraphVisualizers.add(frame);
      }
    });

    m_BoundaryVisualizerBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  if (m_BoundaryVisualizerFrame == null) {
    m_BoundaryVisualizerBut.setEnabled(false);
    m_BoundaryVisualizerFrame = new JFrame("BoundaryVisualizer");
    m_BoundaryVisualizerFrame.setIconImage(m_Icon);
    m_BoundaryVisualizerFrame.getContentPane().setLayout(new BorderLayout());
    m_BoundaryVisualizerFrame.getContentPane().add(new BoundaryVisualizer(), BorderLayout.CENTER);
    m_BoundaryVisualizerFrame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent w) {
        m_BoundaryVisualizerFrame.dispose();
        m_BoundaryVisualizerFrame = null;
        m_BoundaryVisualizerBut.setEnabled(true);
        checkExit();
      }
    });
    m_BoundaryVisualizerFrame.pack();
    m_BoundaryVisualizerFrame.setSize(800, 600);
    m_BoundaryVisualizerFrame.setVisible(true);
    // dont' do a System.exit after last window got closed!
    BoundaryVisualizer.setExitIfNoWindowsOpen(false);
  }
      }
    });

    // help
   
    m_HomepageBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  BrowserHelper.openURL("http://www.cs.waikato.ac.nz/~ml/weka/");
      }
    });

    m_WekaDocBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  BrowserHelper.openURL("http://weka.sourceforge.net/wekadoc/");
      }
    });

    m_WekaWikiBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  BrowserHelper.openURL("http://weka.sourceforge.net/wiki/");
      }
    });

    m_SourceforgeBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  BrowserHelper.openURL("http://sourceforge.net/projects/weka/");
      }
    });

    m_SystemInfoBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  if (m_SystemInfoFrame == null) {
    m_SystemInfoBut.setEnabled(false);
    m_SystemInfoFrame = new JFrame("SystemInfo");
    m_SystemInfoFrame.setIconImage(m_Icon);
    m_SystemInfoFrame.getContentPane().setLayout(new BorderLayout());

    // get info
    Hashtable info = new SystemInfo().getSystemInfo();

    // sort names
    Vector names = new Vector();
    Enumeration enm = info.keys();
    while (enm.hasMoreElements())
      names.add(enm.nextElement());
    Collections.sort(names);

    // generate table
    String[][] data = new String[info.size()][2];
    for (int i = 0; i < names.size(); i++) {
      data[i][0] = names.get(i).toString();
      data[i][1] = info.get(data[i][0]).toString();
    }
    String[] titles = new String[]{"Key", "Value"};
    JTable table = new JTable(data, titles);

    m_SystemInfoFrame.getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
    m_SystemInfoFrame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent w) {
        m_SystemInfoFrame.dispose();
        m_SystemInfoFrame = null;
        m_SystemInfoBut.setEnabled(true);
        checkExit();
      }
    });
    m_SystemInfoFrame.pack();
    m_SystemInfoFrame.setSize(800, 600);
    m_SystemInfoFrame.setVisible(true);
  }
      }
    });

    // other
   
    m_LogWindow.setIconImage(m_Icon);
    m_LogWindowBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        m_LogWindow.setVisible(true);
      }
    });

    m_MemoryUsageBut.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
  if (m_MemoryUsageFrame == null) {
    final MemoryUsagePanel panel = new MemoryUsagePanel();
    m_MemoryUsageBut.setEnabled(false);
    m_MemoryUsageFrame = new JFrame("Memory usage");
    m_MemoryUsageFrame.setIconImage(m_Icon);
    m_MemoryUsageFrame.getContentPane().setLayout(new BorderLayout());
    m_MemoryUsageFrame.getContentPane().add(panel, BorderLayout.CENTER);
    m_MemoryUsageFrame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent w) {
        panel.stopMonitoring();
        m_MemoryUsageFrame.dispose();
        m_MemoryUsageFrame = null;
        m_MemoryUsageBut.setEnabled(true);
        checkExit();
      }
    });
    m_MemoryUsageFrame.pack();
    m_MemoryUsageFrame.setSize(400, 50);
    Point l = panel.getFrameLocation();
    if ((l.x != -1) && (l.y != -1))
      m_MemoryUsageFrame.setLocation(l);
    m_MemoryUsageFrame.setVisible(true);
    Dimension size = m_MemoryUsageFrame.getPreferredSize();
    m_MemoryUsageFrame.setSize(new Dimension((int) size.getWidth(), (int) size.getHeight()));
View Full Code Here

    if (retVal != JFileChooser.APPROVE_OPTION)
      return;

    // build graph
    String filename = m_FileChooserGraphVisualizer.getSelectedFile().getAbsolutePath();
    GraphVisualizer panel = new GraphVisualizer();
    try{
      if (    filename.toLowerCase().endsWith(".xml")
    || filename.toLowerCase().endsWith(".bif") ) {
        panel.readBIF(new FileInputStream(filename));
      }
      else {
        panel.readDOT(new FileReader(filename));
      }
    }
    catch (Exception e) {
      e.printStackTrace();
      JOptionPane.showMessageDialog(
View Full Code Here

    if(grphType == Drawable.BayesNet) {
      final javax.swing.JFrame jf =
  new javax.swing.JFrame("Weka Classifier Graph Visualizer: "+name);
      jf.setSize(500,400);
      jf.getContentPane().setLayout(new BorderLayout());
      GraphVisualizer gv =
  new GraphVisualizer();
      try {
  gv.readBIF(grphString);
      }
      catch (BIFFormatException be) {
  System.err.println("unable to visualize BayesNet"); be.printStackTrace();
      }
      gv.layoutGraph();
      jf.getContentPane().add(gv, BorderLayout.CENTER);
      jf.addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent e) {
            jf.dispose();
    }
View Full Code Here

  protected void visualizeBayesNet(String XMLBIF, String graphName) {
    final javax.swing.JFrame jf =
      new javax.swing.JFrame("Weka Classifier Graph Visualizer: "+graphName);
    jf.setSize(500,400);
    jf.getContentPane().setLayout(new BorderLayout());
    GraphVisualizer gv = new GraphVisualizer();
    try { gv.readBIF(XMLBIF);
    }
    catch(BIFFormatException be) { System.err.println("unable to visualize BayesNet"); be.printStackTrace(); }
    gv.layoutGraph();

    jf.getContentPane().add(gv, BorderLayout.CENTER);
    jf.addWindowListener(new java.awt.event.WindowAdapter() {
  public void windowClosing(java.awt.event.WindowEvent e) {
    jf.dispose();
View Full Code Here

TOP

Related Classes of weka.gui.graphvisualizer.GraphVisualizer$GraphPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.