weka.gui.explorer.VisualizePanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weka-dev Show documentation
Show all versions of weka-dev Show documentation
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* VisualizePanel.java
* Copyright (C) 2007-2012 University of Waikato, Hamilton, New Zealand
*/
package weka.gui.explorer;
import java.awt.BorderLayout;
import weka.core.Instances;
import weka.gui.explorer.Explorer.ExplorerPanel;
import weka.gui.visualize.MatrixPanel;
/**
* A slightly extended MatrixPanel for better support in the Explorer.
*
* @author fracpete (fracpete at waikato dot ac dot nz)
* @version $Revision: 8034 $
* @see MatrixPanel
*/
public class VisualizePanel
extends MatrixPanel
implements ExplorerPanel {
/** for serialization */
private static final long serialVersionUID = 6084015036853918846L;
/** the parent frame */
protected Explorer m_Explorer = null;
/**
* Sets the Explorer to use as parent frame (used for sending notifications
* about changes in the data)
*
* @param parent the parent frame
*/
public void setExplorer(Explorer parent) {
m_Explorer = parent;
}
/**
* returns the parent Explorer frame
*
* @return the parent
*/
public Explorer getExplorer() {
return m_Explorer;
}
/**
* Returns the title for the tab in the Explorer
*
* @return the title of this tab
*/
public String getTabTitle() {
return "Visualize";
}
/**
* Returns the tooltip for the tab in the Explorer
*
* @return the tooltip of this tab
*/
public String getTabTitleToolTip() {
return "Explore the data";
}
/**
* Tests out the visualize panel from the command line.
*
* @param args may optionally contain the name of a dataset to load.
*/
public static void main(String [] args) {
try {
final javax.swing.JFrame jf =
new javax.swing.JFrame("Weka Explorer: Visualize");
jf.getContentPane().setLayout(new BorderLayout());
final VisualizePanel sp = new VisualizePanel();
jf.getContentPane().add(sp, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
System.exit(0);
}
});
jf.pack();
jf.setSize(800, 600);
jf.setVisible(true);
if (args.length == 1) {
System.err.println("Loading instances from " + args[0]);
java.io.Reader r = new java.io.BufferedReader(
new java.io.FileReader(args[0]));
Instances i = new Instances(r);
sp.setInstances(i);
}
} catch (Exception ex) {
ex.printStackTrace();
System.err.println(ex.getMessage());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy