});
m_MoreOptions.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
m_MoreOptions.setEnabled(false);
JPanel moreOptionsPanel = new JPanel();
moreOptionsPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
moreOptionsPanel.setLayout(new GridLayout(10, 1));
moreOptionsPanel.add(m_OutputModelBut);
moreOptionsPanel.add(m_OutputPerClassBut);
moreOptionsPanel.add(m_OutputEntropyBut);
moreOptionsPanel.add(m_OutputConfusionBut);
moreOptionsPanel.add(m_StorePredictionsBut);
JPanel classOutPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
classOutPanel.add(new JLabel("Output predictions"));
classOutPanel.add(m_ClassificationOutputPanel);
moreOptionsPanel.add(classOutPanel);
JPanel costMatrixOption = new JPanel(new FlowLayout(FlowLayout.LEFT));
costMatrixOption.add(m_EvalWRTCostsBut);
costMatrixOption.add(m_SetCostsBut);
moreOptionsPanel.add(costMatrixOption);
JPanel seedPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
seedPanel.add(m_RandomLab);
seedPanel.add(m_RandomSeedText);
moreOptionsPanel.add(seedPanel);
moreOptionsPanel.add(m_PreserveOrderBut);
JPanel sourcePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
m_OutputSourceCode.setEnabled(m_ClassifierEditor.getValue() instanceof Sourcable);
m_SourceCodeClass.setEnabled(m_OutputSourceCode.isEnabled() && m_OutputSourceCode.isSelected());
sourcePanel.add(m_OutputSourceCode);
sourcePanel.add(m_SourceCodeClass);
moreOptionsPanel.add(sourcePanel);
JPanel all = new JPanel();
all.setLayout(new BorderLayout());
JButton oK = new JButton("OK");
JPanel okP = new JPanel();
okP.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
okP.setLayout(new GridLayout(1,1,5,5));
okP.add(oK);
all.add(moreOptionsPanel, BorderLayout.CENTER);
all.add(okP, BorderLayout.SOUTH);
final JDialog jd =
new JDialog(PropertyDialog.getParentFrame(ClassifierPanel.this), "Classifier evaluation options");
jd.getContentPane().setLayout(new BorderLayout());
jd.getContentPane().add(all, BorderLayout.CENTER);
jd.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent w) {
jd.dispose();
m_MoreOptions.setEnabled(true);
}
});
oK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent a) {
m_MoreOptions.setEnabled(true);
jd.dispose();
}
});
jd.pack();
// panel height is only available now
m_ClassificationOutputPanel.setPreferredSize(new Dimension(300, m_ClassificationOutputPanel.getHeight()));
jd.pack();
jd.setLocation(m_MoreOptions.getLocationOnScreen());
jd.setVisible(true);
}
});
// 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 options"),
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);
gbC = new GridBagConstraints();
gbC.anchor = GridBagConstraints.WEST;
gbC.fill = GridBagConstraints.HORIZONTAL;
gbC.gridy = 4; gbC.gridx = 0; gbC.weightx = 100;
gbC.gridwidth = 3;
gbC.insets = new Insets(3, 0, 1, 0);
gbL.setConstraints(m_MoreOptions, gbC);
p2.add(m_MoreOptions);
JPanel buttons = new JPanel();
buttons.setLayout(new GridLayout(2, 2));
buttons.add(m_ClassCombo);
m_ClassCombo.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JPanel ssButs = new JPanel();
ssButs.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
ssButs.setLayout(new GridLayout(1, 2, 5, 5));
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());
final JScrollPane js = new JScrollPane(m_OutText);
p3.add(js, BorderLayout.CENTER);
js.getViewport().addChangeListener(new ChangeListener() {
private int lastHeight;
public void stateChanged(ChangeEvent e) {
JViewport vp = (JViewport)e.getSource();
int h = vp.getViewSize().height;
if (h != lastHeight) { // i.e. an addition not just a user scrolling
lastHeight = h;
int x = h - vp.getExtentSize().height;
vp.setViewPosition(new Point(0, x));
}
}
});
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);
}