public AlgorithmListPanel() {  m_List = new JList(); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) {     int index = m_List.locationToIndex(e.getPoint()); if (index > -1) actionPerformed(new ActionEvent(m_EditBut, 0, "")); } } }; m_List.addMouseListener(mouseListener);  m_ClassifierEditor.setClassType(Classifier.class); m_ClassifierEditor.setValue(new weka.classifiers.rules.ZeroR()); m_ClassifierEditor.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { repaint(); } }); ((GenericObjectEditor.GOEPanel) m_ClassifierEditor.getCustomEditor()).addOkListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Classifier newCopy = (Classifier) copyObject(m_ClassifierEditor.getValue()); addNewAlgorithm(newCopy); } });  m_DeleteBut.setEnabled(false); m_DeleteBut.addActionListener(this); m_AddBut.setEnabled(false); m_AddBut.addActionListener(this); m_EditBut.setEnabled(false); m_EditBut.addActionListener(this); m_LoadOptionsBut.setEnabled(false); m_LoadOptionsBut.addActionListener(this); m_SaveOptionsBut.setEnabled(false); m_SaveOptionsBut.addActionListener(this); m_UpBut.setEnabled(false); m_UpBut.addActionListener(this); m_DownBut.setEnabled(false); m_DownBut.addActionListener(this);  m_List.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { setButtons(e); } });  m_FileChooser.addChoosableFileFilter(m_XMLFilter); m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
public AlgorithmListPanel(Experiment exp) {
  public AlgorithmListPanel() {        m_List = new JList();    MouseListener mouseListener = new MouseAdapter() {      public void mouseClicked(MouseEvent e) {        if (e.getClickCount() == 2) {          // unfortunately, locationToIndex only returns the nearest entry          // and not the exact one, i.e. if there's one item in the list and          // one doublelclicks somewhere in the list, this index will be          // returned          int index = m_List.locationToIndex(e.getPoint());          if (index > -1)            actionPerformed(new ActionEvent(m_EditBut, 0, ""));        }      }    };    m_List.addMouseListener(mouseListener);      m_ClassifierEditor.setClassType(Classifier.class);    m_ClassifierEditor.setValue(new weka.classifiers.rules.ZeroR());    m_ClassifierEditor.addPropertyChangeListener(new PropertyChangeListener() {	public void propertyChange(PropertyChangeEvent e) {	  repaint();	}      });    ((GenericObjectEditor.GOEPanel) m_ClassifierEditor.getCustomEditor()).addOkListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  Classifier newCopy =	    (Classifier) copyObject(m_ClassifierEditor.getValue());	  addNewAlgorithm(newCopy);	}      });        m_DeleteBut.setEnabled(false);    m_DeleteBut.addActionListener(this);    m_AddBut.setEnabled(false);    m_AddBut.addActionListener(this);    m_EditBut.setEnabled(false);    m_EditBut.addActionListener(this);    m_LoadOptionsBut.setEnabled(false);    m_LoadOptionsBut.addActionListener(this);    m_SaveOptionsBut.setEnabled(false);    m_SaveOptionsBut.addActionListener(this);    m_UpBut.setEnabled(false);    m_UpBut.addActionListener(this);    m_DownBut.setEnabled(false);    m_DownBut.addActionListener(this);        m_List.addListSelectionListener(new ListSelectionListener() {        public void valueChanged(ListSelectionEvent e) {          setButtons(e);        }      });        m_FileChooser.addChoosableFileFilter(m_XMLFilter);    m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);    setLayout(new BorderLayout());    setBorder(BorderFactory.createTitledBorder("Algorithms"));    JPanel topLab = new JPanel();    GridBagLayout gb = new GridBagLayout();    GridBagConstraints constraints = new GridBagConstraints();    topLab.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));    topLab.setLayout(gb);       constraints.gridx=0;constraints.gridy=0;constraints.weightx=5;    constraints.fill = GridBagConstraints.HORIZONTAL;    constraints.gridwidth=1;constraints.gridheight=1;    constraints.insets = new Insets(0,2,0,2);    topLab.add(m_AddBut,constraints);    constraints.gridx=1;constraints.gridy=0;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    topLab.add(m_EditBut,constraints);    constraints.gridx=2;constraints.gridy=0;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    topLab.add(m_DeleteBut,constraints);    JPanel bottomLab = new JPanel();    gb = new GridBagLayout();    constraints = new GridBagConstraints();    bottomLab.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));    bottomLab.setLayout(gb);        constraints.gridx=0;constraints.gridy=0;constraints.weightx=5;    constraints.fill = GridBagConstraints.HORIZONTAL;    constraints.gridwidth=1;constraints.gridheight=1;    constraints.insets = new Insets(0,2,0,2);    bottomLab.add(m_LoadOptionsBut,constraints);    constraints.gridx=1;constraints.gridy=0;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    bottomLab.add(m_SaveOptionsBut,constraints);    constraints.gridx=2;constraints.gridy=0;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    bottomLab.add(m_UpBut,constraints);    constraints.gridx=3;constraints.gridy=0;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    bottomLab.add(m_DownBut,constraints);    add(topLab, BorderLayout.NORTH);    add(new JScrollPane(m_List), BorderLayout.CENTER);    add(bottomLab, BorderLayout.SOUTH);  }