公告 |
求真务实打基础, 宁缺毋滥读好书。
数据挖掘青年(DMman) |
链接 |
|
Blog信息 |
blog名称:DMman(数据挖掘青年) 日志总数:102 评论数量:564 留言数量:57 访问次数:1757180 建立时间:2007年4月9日 |

| |
[Weka]weka源码学习界面编程(1)myGUIChooser.java  原创空间
数据挖掘青年 发表于 2007/4/11 20:45:46 |
weka版本:3.4.10
myGUIChooser.java 可直接编译通过,效果如图(在相同目录下请准备一张名为zhou.gif的图片)。
500)this.width=500'>
代码如下(有关weka的部分代码仅注释掉,没有删去,方便大家对照weka源码学习):
//import weka.core.Memory;//import weka.core.Version;//import weka.gui.explorer.Explorer;//import weka.gui.experiment.Experimenter;//import weka.gui.beans.KnowledgeFlow;//import weka.gui.beans.KnowledgeFlowApp;
import java.awt.Panel;import java.awt.Button;import java.awt.GridLayout;import java.awt.Frame;import java.awt.Label;import java.awt.BorderLayout;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;import java.awt.Image;import java.awt.Toolkit;import javax.swing.ImageIcon;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.JLabel;import javax.swing.JOptionPane;//maybe dont used hereimport javax.swing.SwingConstants;import javax.swing.BorderFactory;
/** * The main class for the Weka myGUIChooser. Lets the user choose * which GUI they want to run. * * @author Len Trigg (trigg@cs.waikato.ac.nz) * @author Mark Hall (mhall@cs.waikato.ac.nz) * @version $Revision: 1.14.2.12 $ */public class myGUIChooser extends JFrame implements ActionListener{
/** Click to open the mySimpleCLI */ protected Button m_SimpleBut = new Button("Simple CLI");
/** Click to open the Explorer */ protected Button m_ExplorerBut = new Button("Explorer");
/** Click to open the Explorer */ protected Button m_ExperimenterBut = new Button("Experimenter");
/** Click to open the KnowledgeFlow */ protected Button m_KnowledgeFlowBut = new Button("KnowledgeFlow");
/** The mySimpleCLI */ // protected mySimpleCLI m_mySimpleCLI; protected JFrame m_mySimpleCLI; /** The frame containing the explorer interface */ protected JFrame m_ExplorerFrame;
/** The frame containing the experiment interface */ protected JFrame m_ExperimenterFrame;
/** The frame containing the knowledge flow interface */ protected JFrame m_KnowledgeFlowFrame;
/** The weka image */ Image m_weka = Toolkit.getDefaultToolkit(). getImage(ClassLoader.getSystemResource("zhou.gif"));
/** * Creates the experiment environment gui with no initial experiment */ public myGUIChooser() {
super("myWeka GUI Chooser"); Image icon = Toolkit.getDefaultToolkit(). getImage(ClassLoader.getSystemResource("zhou.gif")); setIconImage(icon);
this.getContentPane().setLayout(new BorderLayout()); JPanel wbuts = new JPanel(); wbuts.setBorder(BorderFactory.createTitledBorder("myGUI")); wbuts.setLayout(new GridLayout(2, 2)); wbuts.add(m_SimpleBut); wbuts.add(m_ExplorerBut); wbuts.add(m_ExperimenterBut); wbuts.add(m_KnowledgeFlowBut); this.getContentPane().add(wbuts, BorderLayout.SOUTH); JPanel wekaPan = new JPanel(); wekaPan.setToolTipText("Mr Zhou,Not a native bird of New Zealand!"); ImageIcon wii = new ImageIcon(m_weka); JLabel wekaLab = new JLabel(wii); wekaPan.add(wekaLab); this.getContentPane().add(wekaPan, BorderLayout.CENTER); JPanel titlePan = new JPanel(); titlePan.setLayout(new GridLayout(8,1)); titlePan.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); titlePan.add(new JLabel("DMman Environment for", SwingConstants.CENTER)); titlePan.add(new JLabel("Knowledge Analysis", SwingConstants.CENTER)); titlePan.add(new JLabel("")); titlePan.add(new JLabel("Version 2007-4-10" , SwingConstants.CENTER)); titlePan.add(new JLabel("")); titlePan.add(new JLabel("(c) 1999 - 2007", SwingConstants.CENTER)); titlePan.add(new JLabel("University of Ocean", SwingConstants.CENTER)); titlePan.add(new JLabel("Qing Dao", SwingConstants.CENTER)); this.getContentPane().add(titlePan, BorderLayout.NORTH);
m_SimpleBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { m_mySimpleCLI = new JFrame("m_mySimpleCLI"); JOptionPane.showMessageDialog(m_ExperimenterFrame,"You pressed SimpleCLI.","info",JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { throw new Error("Couldn't start m_ExperimenterFrame!"); } } });
m_ExplorerBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { m_ExplorerFrame = new JFrame("m_ExplorerFrame"); Object[] options = {"Yes, please", "No, thanks", "cancel"};int n = JOptionPane.showOptionDialog(m_ExplorerFrame, "You pressed Explorer", "A Silly Question", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[2]);m_ExplorerFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent w) { System.out.println("m_ExplorerFrame window close--conment by DMman"); m_ExplorerFrame.dispose(); m_ExplorerFrame = null; m_ExplorerBut.setEnabled(true); // checkExit(); } }); } });
m_ExperimenterBut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { m_ExperimenterFrame = new JFrame("m_ExperimenterFrame"); JOptionPane.showMessageDialog(m_ExperimenterFrame,"You pressed ExperimenterFrame.","info",JOptionPane.INFORMATION_MESSAGE); } catch (Exception ex) { throw new Error("Couldn't start m_ExperimenterFrame!"); } } });
}
/** variable for the myGUIChooser class which would be set to null by the memory monitoring thread to free up some memory if we running out of memory */ private static myGUIChooser m_chooser;
public void actionPerformed(ActionEvent e) {
try { } catch (Exception ex) { System.err.println(ex.getMessage()); } }
public static void main(String [] args) {
// LookAndFeel.setLookAndFeel(); try {
m_chooser = new myGUIChooser(); m_chooser.setVisible(true); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } m_chooser.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent w) { System.out.println("window close--conment by DMman"); m_chooser.dispose(); m_chooser = null; } }); m_chooser.pack(); }} |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
超越地平线(游客)发表评论于2013/3/14 20:57:29 |
以下引用yinrenxingzhe(游客)在2008-3-3 16:14:24的评论:
呵呵,楼主好棒,这样一修改不就成了自己的数据挖掘工具了嘛!真是不错呢!向你学习这个只要看界面类的源码就可以做了吧? |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
yinrenxingzhe(游客)发表评论于2008/3/5 10:40:40 |
在我的机器上用eclipse运行时,在任务管理器中显示了javaw.exe进程,控制台也没有提示出错,但为什么不能显示窗口呢?请DMman给与解答。谢谢!
以下为blog主人的回复:
图片的路径? |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
yinrenxingzhe(游客)发表评论于2008/3/3 16:14:24 |
呵呵,楼主好棒,这样一修改不就成了自己的数据挖掘工具了嘛!真是不错呢!向你学习 |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
kevin(游客)发表评论于2007/10/14 23:38:27 |
请问哪里有WEKA 的原码下载?谢谢!
以下为blog主人的回复:
weka http://www.cs.waikato.ac.nz/ml/weka/ |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
asay(游客)发表评论于2007/10/11 21:12:19 |
加个 addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); 就完美了 哈哈
以下为blog主人的回复:
是应该有;当初学习的时候还没有用过GUI工具,现在在Eclipse中用SWing Designer, 方便多了 |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
doa-3(游客)发表评论于2007/6/16 17:25:20 |
可以告诉我哪儿有WEKA的Multilayer Perceptron的源代码下载啊
以下为blog主人的回复:
多层传感器算法是weka分类器中的一个算法(隶属于 function模块),可以在Weka的源码中找到它,但是分离出来的单独的算法 好像还没有。
以下为blog主人的回复:
如果你只是想看多层传感器算法,可以找些人工神经网络的源码来看看,反向传播网络 挺多的。 |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
徐涵(Han Xu)发表评论于2007/4/11 23:55:33 |
欢迎来www.ieee.org.cn Web挖掘版
以下为blog主人的回复:
OK,是个不错的交流平台。可惜实质性的内容还是太少了,大家共同努力啊,把数据挖掘发扬光大。 |
|
回复:weka源码学习界面编程(1)myGUIChooser.java 原创空间
数据挖掘青年发表评论于2007/4/11 21:46:36 |
有关于weka的问题,欢迎大家留言讨论,以互相学习! |
|
» 1 »
|