weka.gui.beans.BeanConnection.reset(); weka.gui.beans.BeanInstance.reset(null);
  public GUIChooser() {    super("Weka GUI Chooser");        Image icon = Toolkit.getDefaultToolkit().    getImage(ClassLoader.getSystemResource("weka/gui/weka_icon.gif"));    setIconImage(icon);    this.getContentPane().setLayout(new BorderLayout());    JPanel wbuts = new JPanel();    wbuts.setBorder(BorderFactory.createTitledBorder("GUI"));    wbuts.setLayout(new GridLayout(3, 2));    wbuts.add(m_SimpleBut);    wbuts.add(m_ExplorerBut);    wbuts.add(m_ExperimenterBut);    wbuts.add(m_KnowledgeFlowBut);    wbuts.add(m_ArffViewerBut);    wbuts.add(m_LogWindowBut);    this.getContentPane().add(wbuts, BorderLayout.SOUTH);        JPanel wekaPan = new JPanel();    wekaPan.setToolTipText("Weka, 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("Waikato Environment for",                            SwingConstants.CENTER));    titlePan.add(new JLabel("Knowledge Analysis",                            SwingConstants.CENTER));    titlePan.add(new JLabel(""));    titlePan.add(new JLabel("Version " + Version.VERSION,                            SwingConstants.CENTER));    titlePan.add(new JLabel(""));    titlePan.add(new JLabel("(c) 1999 - 2005",    SwingConstants.CENTER));    titlePan.add(new JLabel("University of Waikato",    SwingConstants.CENTER));    titlePan.add(new JLabel("New Zealand",    SwingConstants.CENTER));    this.getContentPane().add(titlePan, BorderLayout.NORTH);        m_SimpleBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        if (m_SimpleCLI == null) {          m_SimpleBut.setEnabled(false);          try {            m_SimpleCLI = new SimpleCLI();          } catch (Exception ex) {            throw new Error("Couldn't start SimpleCLI!");          }          m_SimpleCLI.addWindowListener(new WindowAdapter() {            public void windowClosing(WindowEvent w) {              m_SimpleCLI.dispose();              m_SimpleCLI = null;              m_SimpleBut.setEnabled(true);              checkExit();            }          });          m_SimpleCLI.setVisible(true);        }      }    });    m_ExplorerBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	if (m_ExplorerFrame == null) {	  m_ExplorerBut.setEnabled(false);	  m_ExplorerFrame = new JFrame("Weka Explorer");	  m_ExplorerFrame.getContentPane().setLayout(new BorderLayout());	  m_ExplorerFrame.getContentPane()	    .add(new Explorer(), BorderLayout.CENTER);	  m_ExplorerFrame.addWindowListener(new WindowAdapter() {	    public void windowClosing(WindowEvent w) {	      m_ExplorerFrame.dispose();	      m_ExplorerFrame = null;	      m_ExplorerBut.setEnabled(true);	      checkExit();	    }	  });	  m_ExplorerFrame.pack();	  m_ExplorerFrame.setSize(800, 600);	  m_ExplorerFrame.setVisible(true);	}      }    });    m_ExperimenterBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	if (m_ExperimenterFrame == null) {	  m_ExperimenterBut.setEnabled(false);	  m_ExperimenterFrame = new JFrame("Weka Experiment Environment");	  m_ExperimenterFrame.getContentPane().setLayout(new BorderLayout());	  m_ExperimenterFrame.getContentPane()	    .add(new Experimenter(false), BorderLayout.CENTER);	  m_ExperimenterFrame.addWindowListener(new WindowAdapter() {	    public void windowClosing(WindowEvent w) {	      m_ExperimenterFrame.dispose();	      m_ExperimenterFrame = null;	      m_ExperimenterBut.setEnabled(true);	      checkExit();	    }	  });	  m_ExperimenterFrame.pack();	  m_ExperimenterFrame.setSize(800, 600);	  m_ExperimenterFrame.setVisible(true);	}      }    });    KnowledgeFlowApp.addStartupListener(new weka.gui.beans.StartUpListener() {        public void startUpComplete() {          if (m_KnowledgeFlowFrame == null) {            KnowledgeFlowApp kna = KnowledgeFlowApp.getSingleton();            m_KnowledgeFlowBut.setEnabled(false);            m_KnowledgeFlowFrame = new JFrame("Weka KnowledgeFlow Environment");            m_KnowledgeFlowFrame.getContentPane().setLayout(new BorderLayout());            m_KnowledgeFlowFrame.getContentPane()              .add(kna, BorderLayout.CENTER);            m_KnowledgeFlowFrame.addWindowListener(new WindowAdapter() {                public void windowClosing(WindowEvent w) {                  m_KnowledgeFlowFrame.dispose();                  m_KnowledgeFlowFrame = null;                  weka.gui.beans.BeanConnection.reset();                  weka.gui.beans.BeanInstance.reset(null);                  m_KnowledgeFlowBut.setEnabled(true);                  checkExit();                }              });            m_KnowledgeFlowFrame.pack();            m_KnowledgeFlowFrame.setSize(900, 600);            m_KnowledgeFlowFrame.setVisible(true);          }        }      });    m_KnowledgeFlowBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        KnowledgeFlow.startApp();      }    });    m_ArffViewerBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        ArffViewer av = new ArffViewer();        av.setVisible(true);        m_ArffViewers.add(av);      }    });    m_LogWindowBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        m_LogWindow.setVisible(true);      }    });    addWindowListener(new WindowAdapter() {      public void windowClosing(WindowEvent w) {	dispose();	checkExit();      }    });    pack();  }