m_ClassCombo.setToolTipText("Select the attribute to use as the class"); m_TrainBut.setToolTipText("Test on the same set that the classifier" + " is trained on"); m_CVBut.setToolTipText("Perform a n-fold cross-validation"); m_PercentBut.setToolTipText("Train on a percentage of the data and" + " test on the remainder"); m_TestSplitBut.setToolTipText("Test on a user-specified dataset"); m_StartBut.setToolTipText("Starts the classification"); m_StopBut.setToolTipText("Stops a running classification");
  public ClassifierPanel() {    // Connect / configure the components    m_OutText.setEditable(false);    m_OutText.setFont(new Font("Dialoginput", Font.PLAIN, 10));    m_OutText.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));    m_History.setBorder(BorderFactory.createTitledBorder("Result list"));    m_ClassifierEditor.setClassType(Classifier.class);    m_ClassifierEditor.setValue(new weka.classifiers.ZeroR());    m_ClassifierEditor.addPropertyChangeListener(new PropertyChangeListener() {      public void propertyChange(PropertyChangeEvent e) {	repaint();      }    });    m_ClassCombo.setEnabled(false);    m_CVBut.setSelected(true);    updateRadioLinks();    ButtonGroup bg = new ButtonGroup();    bg.add(m_TrainBut);    bg.add(m_CVBut);    bg.add(m_PercentBut);    bg.add(m_TestSplitBut);    m_TrainBut.addActionListener(m_RadioListener);    m_CVBut.addActionListener(m_RadioListener);    m_PercentBut.addActionListener(m_RadioListener);    m_TestSplitBut.addActionListener(m_RadioListener);    m_SetTestBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	setTestSet();      }    });    m_StartBut.setEnabled(false);    m_StopBut.setEnabled(false);    m_StartBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	startClassifier();      }    });    m_StopBut.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	stopClassifier();      }    });    // Layout the GUI    JPanel p1 = new JPanel();    p1.setBorder(BorderFactory.createCompoundBorder(		 BorderFactory.createTitledBorder("Classifier"),		 BorderFactory.createEmptyBorder(0, 5, 5, 5)		 ));    p1.setLayout(new BorderLayout());    p1.add(m_CEPanel, BorderLayout.NORTH);    JPanel p2 = new JPanel();    GridBagLayout gbL = new GridBagLayout();    p2.setLayout(gbL);    p2.setBorder(BorderFactory.createCompoundBorder(		 BorderFactory.createTitledBorder("Test mode"),		 BorderFactory.createEmptyBorder(0, 5, 5, 5)		 ));    GridBagConstraints gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.WEST;    gbC.gridy = 0;     gbC.gridx = 0;    gbL.setConstraints(m_TrainBut, gbC);    p2.add(m_TrainBut);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.WEST;    gbC.gridy = 1;     gbC.gridx = 0;    gbL.setConstraints(m_TestSplitBut, gbC);    p2.add(m_TestSplitBut);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.EAST;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 1;     gbC.gridx = 1;    gbC.gridwidth = 2;    gbC.insets = new Insets(2, 10, 2, 0);    gbL.setConstraints(m_SetTestBut, gbC);    p2.add(m_SetTestBut);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.WEST;    gbC.gridy = 2;     gbC.gridx = 0;    gbL.setConstraints(m_CVBut, gbC);    p2.add(m_CVBut);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.EAST;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 2;     gbC.gridx = 1;    gbC.insets = new Insets(2, 10, 2, 10);    gbL.setConstraints(m_CVLab, gbC);    p2.add(m_CVLab);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.EAST;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 2;     gbC.gridx = 2;  gbC.weightx = 100;    gbC.ipadx = 20;    gbL.setConstraints(m_CVText, gbC);    p2.add(m_CVText);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.WEST;    gbC.gridy = 3;     gbC.gridx = 0;    gbL.setConstraints(m_PercentBut, gbC);    p2.add(m_PercentBut);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.EAST;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 3;     gbC.gridx = 1;    gbC.insets = new Insets(2, 10, 2, 10);    gbL.setConstraints(m_PercentLab, gbC);    p2.add(m_PercentLab);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.EAST;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 3;     gbC.gridx = 2;  gbC.weightx = 100;    gbC.ipadx = 20;    gbL.setConstraints(m_PercentText, gbC);    p2.add(m_PercentText);    JPanel buttons = new JPanel();    buttons.setLayout(new GridLayout(2, 1));    buttons.add(m_ClassCombo);    JPanel ssButs = new JPanel();    ssButs.setLayout(new GridLayout(1, 2));    ssButs.add(m_StartBut);    ssButs.add(m_StopBut);    buttons.add(ssButs);        JPanel p3 = new JPanel();    p3.setBorder(BorderFactory.createTitledBorder("Classifier output"));    p3.setLayout(new BorderLayout());    p3.add(new JScrollPane(m_OutText), BorderLayout.CENTER);    JPanel mondo = new JPanel();    gbL = new GridBagLayout();    mondo.setLayout(gbL);    gbC = new GridBagConstraints();    //    gbC.anchor = GridBagConstraints.WEST;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 0;     gbC.gridx = 0;    gbL.setConstraints(p2, gbC);    mondo.add(p2);    gbC = new GridBagConstraints();    gbC.anchor = GridBagConstraints.NORTH;    gbC.fill = GridBagConstraints.HORIZONTAL;    gbC.gridy = 1;     gbC.gridx = 0;    gbL.setConstraints(buttons, gbC);    mondo.add(buttons);    gbC = new GridBagConstraints();    //gbC.anchor = GridBagConstraints.NORTH;    gbC.fill = GridBagConstraints.BOTH;    gbC.gridy = 2;     gbC.gridx = 0; gbC.weightx = 0;    gbL.setConstraints(m_History, gbC);    mondo.add(m_History);    gbC = new GridBagConstraints();    gbC.fill = GridBagConstraints.BOTH;    gbC.gridy = 0;     gbC.gridx = 1;    gbC.gridheight = 3;    gbC.weightx = 100; gbC.weighty = 100;    gbL.setConstraints(p3, gbC);    mondo.add(p3);    setLayout(new BorderLayout());    add(p1, BorderLayout.NORTH);    add(mondo, BorderLayout.CENTER);  }