新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 搜索引擎, 信息分类与检索, 语义搜索, Lucene, Nutch, GRUB, Larbin, Weka
    [返回] 中文XML论坛 - 专业的XML技术讨论区计算机技术与应用『 Web挖掘技术 』 → weka源码 之 GUIChooser.java 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 9063 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: weka源码 之 GUIChooser.java 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     DMman 帅哥哟,离线,有人找我吗?魔羯座1984-1-11
      
      
      威望:1
      头衔:数据挖掘青年
      等级:研二(Pi-Calculus看得一头雾水)(版主)
      文章:803
      积分:5806
      门派:W3CHINA.ORG
      注册:2007/4/9

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给DMman发送一个短消息 把DMman加入好友 查看DMman的个人资料 搜索DMman在『 Web挖掘技术 』 的所有贴子 点击这里发送电邮给DMman 访问DMman的主页 引用回复这个贴子 回复这个贴子 查看DMman的博客楼主
    发贴心情 weka源码 之 GUIChooser.java

    myGUIChooser.java 可直接编译通过,效果如图(在相同目录下请准备一张名为zhou.gif的图片)。

        按此在新窗口浏览图片            

    代码如下(有关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 here
    import 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();
      }
    }


       收藏   分享  
    顶(0)
      




    ----------------------------------------------
    数据挖掘青年 http://blogger.org.cn/blog/blog.asp?name=DMman
    纪录片之家 (很多纪录片下载)http://www.jlpzj.com/?fromuid=137653

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/4/12 8:53:00
     
     DMman 帅哥哟,离线,有人找我吗?魔羯座1984-1-11
      
      
      威望:1
      头衔:数据挖掘青年
      等级:研二(Pi-Calculus看得一头雾水)(版主)
      文章:803
      积分:5806
      门派:W3CHINA.ORG
      注册:2007/4/9

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给DMman发送一个短消息 把DMman加入好友 查看DMman的个人资料 搜索DMman在『 Web挖掘技术 』 的所有贴子 点击这里发送电邮给DMman 访问DMman的主页 引用回复这个贴子 回复这个贴子 查看DMman的博客2
    发贴心情 
    更多内容尽在http://blogger.org.cn/blog/blog.asp?subjectid=2725&name=DMman
    欢迎大家提问交流,谢谢。

    ----------------------------------------------
    数据挖掘青年 http://blogger.org.cn/blog/blog.asp?name=DMman
    纪录片之家 (很多纪录片下载)http://www.jlpzj.com/?fromuid=137653

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/4/12 8:55:00
     
     jay2jin 帅哥哟,离线,有人找我吗?白羊座1986-4-1
      
      
      等级:大一新生
      文章:7
      积分:83
      门派:XML.ORG.CN
      注册:2007/5/27

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jay2jin发送一个短消息 把jay2jin加入好友 查看jay2jin的个人资料 搜索jay2jin在『 Web挖掘技术 』 的所有贴子 引用回复这个贴子 回复这个贴子 查看jay2jin的博客3
    发贴心情 
    顶一下先 .....  DMman  ~~~
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/5/27 22:33:00
     
     yinrenxingzhe 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:0
      积分:60
      门派:XML.ORG.CN
      注册:2007/10/20

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给yinrenxingzhe发送一个短消息 把yinrenxingzhe加入好友 查看yinrenxingzhe的个人资料 搜索yinrenxingzhe在『 Web挖掘技术 』 的所有贴子 引用回复这个贴子 回复这个贴子 查看yinrenxingzhe的博客4
    发贴心情 
    DMman,支持你!
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/7 13:33:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Web挖掘技术 』 的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/30 15:14:54

    本主题贴数4,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    187.500ms