public VisualizePanel() { m_XCombo.setToolTipText("Select the attribute for the x axis"); m_YCombo.setToolTipText("Select the attribute for the y axis"); m_ColourCombo.setToolTipText("Select the attribute to colour on"); m_ShapeCombo.setToolTipText("Select the shape to use for data selection");  m_XCombo.setEnabled(false); m_YCombo.setEnabled(false); m_ColourCombo.setEnabled(false); m_ShapeCombo.setEnabled(false);  m_colorList = new FastVector(10); for (int noa = m_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(); }  m_colorList.addElement(pc); }  m_XCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selected = m_XCombo.getSelectedIndex(); if (selected < 0) { selected = 0; } m_plot.setXindex(selected); m_plot.determineBounds(); m_attrib.setX(selected);  if (listener != null) { listener.actionPerformed(e); } } });  m_YCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selected = m_YCombo.getSelectedIndex(); if (selected < 0) { selected = 0; } m_plot.setYindex(selected); m_plot.determineBounds(); m_attrib.setY(selected);  if (listener != null) { listener.actionPerformed(e); } } });  m_ColourCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selected = m_ColourCombo.getSelectedIndex(); if (selected < 0) { selected = 0; } m_plot.setCindex(selected); m_plot.determineBounds();  if (listener != null) { listener.actionPerformed(e); } } });   m_ShapeCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selected = m_ShapeCombo.getSelectedIndex(); if (selected < 0) { selected = 0; } m_plot.setSindex(selected);  if (listener != null) { listener.actionPerformed(e); } } });      m_Jitter.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { m_plot.setJitter(m_Jitter.getValue()); } });  JPanel combos = new JPanel(); GridBagLayout gb = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints();   m_XCombo.setLightWeightPopupEnabled(false); m_YCombo.setLightWeightPopupEnabled(false); m_ColourCombo.setLightWeightPopupEnabled(false); m_ShapeCombo.setLightWeightPopupEnabled(false); combos.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));  combos.setLayout(gb); constraints.gridx=0;constraints.gridy=0;constraints.weightx=5; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridwidth=2;constraints.gridheight=1; constraints.insets = new Insets(0,2,0,2); combos.add(m_XCombo,constraints); constraints.gridx=2;constraints.gridy=0;constraints.weightx=5; constraints.gridwidth=2;constraints.gridheight=1; combos.add(m_YCombo,constraints); constraints.gridx=0;constraints.gridy=1;constraints.weightx=5; constraints.gridwidth=2;constraints.gridheight=1; combos.add(m_ColourCombo,constraints);  constraints.gridx=2;constraints.gridy=1;constraints.weightx=5; constraints.gridwidth=2;constraints.gridheight=1; combos.add(m_ShapeCombo,constraints);  constraints.gridx=0;constraints.gridy=2;constraints.weightx=5; constraints.gridwidth=1;constraints.gridheight=1; combos.add(m_submit, constraints);  constraints.gridx=1;constraints.gridy=2;constraints.weightx=5; constraints.gridwidth=1;constraints.gridheight=1; combos.add(m_cancel, constraints);   constraints.gridx=2;constraints.gridy=2;constraints.weightx=5; constraints.insets = new Insets(10,0,0,5); combos.add(m_JitterLab,constraints); constraints.gridx=3;constraints.gridy=2; constraints.weightx=5; constraints.insets = new Insets(10,0,0,0); combos.add(m_Jitter,constraints);  JPanel cp = new JPanel(); cp.setBorder(BorderFactory.createTitledBorder("Class colour")); cp.setLayout(new BorderLayout());  m_classPanel.setBorder(BorderFactory.createEmptyBorder(15,10,10,10)); cp.add(m_classPanel, BorderLayout.CENTER);    GridBagLayout gb2 = new GridBagLayout(); m_plotSurround.setBorder(BorderFactory.createTitledBorder("Plot")); m_plotSurround.setLayout(gb2);   constraints.fill = constraints.BOTH; constraints.insets = new Insets(0, 0, 0, 10); constraints.gridx=0;constraints.gridy=0;constraints.weightx=3; constraints.gridwidth=4;constraints.gridheight=1;constraints.weighty=5; m_plotSurround.add(m_plot, constraints);  constraints.insets = new Insets(0, 0, 0, 0); constraints.gridx=4;constraints.gridy=0;constraints.weightx=1; constraints.gridwidth=1;constraints.gridheight=1;constraints.weighty=5; m_plotSurround.add(m_attrib, constraints);    setLayout(new BorderLayout()); add(combos, BorderLayout.NORTH); add(m_plotSurround, BorderLayout.CENTER); add(cp, BorderLayout.SOUTH);   String [] SNames = new String [4]; SNames[0] = "Select Instance"; SNames[1] = "Rectangle"; SNames[2] = "Polygon"; SNames[3] = "Polyline";  m_ShapeCombo.setModel(new DefaultComboBoxModel(SNames)); m_ShapeCombo.setEnabled(true);
public VisualizePanel(VisualizePanelListener ls) { this(); m_splitListener = ls;
  public VisualizePanel() {    m_XCombo.setToolTipText("Select the attribute for the x axis");    m_YCombo.setToolTipText("Select the attribute for the y axis");    m_ColourCombo.setToolTipText("Select the attribute to colour on");    m_ShapeCombo.setToolTipText("Select the shape to use for data selection");     //////////    m_XCombo.setEnabled(false);    m_YCombo.setEnabled(false);    m_ColourCombo.setEnabled(false);    m_ShapeCombo.setEnabled(false);    m_colorList = new FastVector(10);    for (int noa = m_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();      }            m_colorList.addElement(pc);    }        m_XCombo.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  int selected = m_XCombo.getSelectedIndex();	  if (selected < 0) {	    selected = 0;	  }	  m_plot.setXindex(selected);	  m_plot.determineBounds();	  m_attrib.setX(selected);	  // try sending on the event if anyone is listening	  if (listener != null) {	    listener.actionPerformed(e);	  }	}      });    m_YCombo.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  int selected = m_YCombo.getSelectedIndex();	  if (selected < 0) {	    selected = 0;	  }	  m_plot.setYindex(selected);	  m_plot.determineBounds();	  m_attrib.setY(selected);	  // try sending on the event if anyone is listening	  if (listener != null) {	    listener.actionPerformed(e);	  }	}      });    m_ColourCombo.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  int selected = m_ColourCombo.getSelectedIndex();	  if (selected < 0) {	    selected = 0;	  }	  m_plot.setCindex(selected);	  m_plot.determineBounds();	  // try sending on the event if anyone is listening	  if (listener != null) {	    listener.actionPerformed(e);	  }	}      });        ///////    m_ShapeCombo.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  int selected = m_ShapeCombo.getSelectedIndex();	  if (selected < 0) {	    selected = 0;	  }	  m_plot.setSindex(selected);	  // try sending on the event if anyone is listening	  if (listener != null) {	    listener.actionPerformed(e);	  }	}      });    /*  m_submit.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  if (m_splitListener != null)	    {	      //then tell the classifier that a new split has been made	      m_splitListener.userDataEvent(new VisualizePanelEvent(	      }*/    ///////////////////////////////////////    m_Jitter.addChangeListener(new ChangeListener() {	public void stateChanged(ChangeEvent e) {	  m_plot.setJitter(m_Jitter.getValue());	}      });        JPanel combos = new JPanel();    GridBagLayout gb = new GridBagLayout();    GridBagConstraints constraints = new GridBagConstraints();    m_XCombo.setLightWeightPopupEnabled(false);    m_YCombo.setLightWeightPopupEnabled(false);    m_ColourCombo.setLightWeightPopupEnabled(false);    m_ShapeCombo.setLightWeightPopupEnabled(false);    combos.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5));    //    combos.setLayout(new GridLayout(1,3,5,5));    combos.setLayout(gb);    constraints.gridx=0;constraints.gridy=0;constraints.weightx=5;    constraints.fill = GridBagConstraints.HORIZONTAL;    constraints.gridwidth=2;constraints.gridheight=1;    constraints.insets = new Insets(0,2,0,2);    combos.add(m_XCombo,constraints);    constraints.gridx=2;constraints.gridy=0;constraints.weightx=5;    constraints.gridwidth=2;constraints.gridheight=1;    combos.add(m_YCombo,constraints);    constraints.gridx=0;constraints.gridy=1;constraints.weightx=5;    constraints.gridwidth=2;constraints.gridheight=1;    combos.add(m_ColourCombo,constraints);    //    constraints.gridx=2;constraints.gridy=1;constraints.weightx=5;    constraints.gridwidth=2;constraints.gridheight=1;    combos.add(m_ShapeCombo,constraints);        constraints.gridx=0;constraints.gridy=2;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    combos.add(m_submit, constraints);        constraints.gridx=1;constraints.gridy=2;constraints.weightx=5;    constraints.gridwidth=1;constraints.gridheight=1;    combos.add(m_cancel, constraints);    ////////////////////////////////    constraints.gridx=2;constraints.gridy=2;constraints.weightx=5;    constraints.insets = new Insets(10,0,0,5);    combos.add(m_JitterLab,constraints);    constraints.gridx=3;constraints.gridy=2;    constraints.weightx=5;    constraints.insets = new Insets(10,0,0,0);    combos.add(m_Jitter,constraints);    JPanel cp = new JPanel();    cp.setBorder(BorderFactory.createTitledBorder("Class colour"));     cp.setLayout(new BorderLayout());    m_classPanel.setBorder(BorderFactory.createEmptyBorder(15,10,10,10));    cp.add(m_classPanel, BorderLayout.CENTER);    GridBagLayout gb2 = new GridBagLayout();    m_plotSurround.setBorder(BorderFactory.createTitledBorder("Plot"));    m_plotSurround.setLayout(gb2);    //m_plotSurround.add(m_plot, BorderLayout.CENTER);    //m_plotSurround.add(m_attrib, BorderLayout.CENTER);    constraints.fill = constraints.BOTH;    constraints.insets = new Insets(0, 0, 0, 10);    constraints.gridx=0;constraints.gridy=0;constraints.weightx=3;    constraints.gridwidth=4;constraints.gridheight=1;constraints.weighty=5;    m_plotSurround.add(m_plot, constraints);        constraints.insets = new Insets(0, 0, 0, 0);    constraints.gridx=4;constraints.gridy=0;constraints.weightx=1;    constraints.gridwidth=1;constraints.gridheight=1;constraints.weighty=5;    m_plotSurround.add(m_attrib, constraints);        setLayout(new BorderLayout());    add(combos, BorderLayout.NORTH);    add(m_plotSurround, BorderLayout.CENTER);    add(cp, BorderLayout.SOUTH);        String [] SNames = new String [4];    SNames[0] = "Select Instance";    SNames[1] = "Rectangle";    SNames[2] = "Polygon";    SNames[3] = "Polyline";    m_ShapeCombo.setModel(new DefaultComboBoxModel(SNames));    m_ShapeCombo.setEnabled(true);  }