List of usage examples for weka.gui.visualize ClassPanel ClassPanel
public ClassPanel()
From source file:milk.visualize.MIPanel.java
License:Open Source License
/** * Constructor: it has 2 comboboxes to select Id and class of * exemplars respectively, and one ClassPanel to show the class * labels/*w w w. j a va2s.c o m*/ */ public MIPanel() { change = new PropertyChangeSupport(this); colorList = new FastVector(10); for (int noa = colorList.size(); noa < 10; noa++) { Color pc = m_DefaultColors[noa % 10]; int ija = noa / 10; ija *= 2; for (int j = 0; j < ija; j++) { pc = pc.darker(); } colorList.addElement(pc); } cp = new ClassPanel(); cp.setColours(colorList); cp.addRepaintNotify(this); cp.setEnabled(false); ip = new JPanel(); clas = new JComboBox(); id = new JComboBox(); ip.setLayout(new GridLayout(1, 2)); ip.add(clas); ip.add(id); ip.setEnabled(false); clas.addItem("Select class index"); id.addItem("Select ID index"); clas.setSelectedIndex(0); id.setSelectedIndex(0); setLayout(new BorderLayout()); add(cp, BorderLayout.SOUTH); add(ip, BorderLayout.NORTH); clas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (clas.getSelectedIndex() > 0) setClassIndex(clas.getSelectedIndex() - 1); } }); id.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (id.getSelectedIndex() > 0) setIdIndex(id.getSelectedIndex() - 1); } }); }