createTitledBorder("Num. samples per region"));
createTitledBorder("Num. locations per pixel"));
  public BoundaryVisualizer() {        setLayout(new BorderLayout());    m_classAttBox.setMinimumSize(COMBO_SIZE);    m_classAttBox.setPreferredSize(COMBO_SIZE);    m_classAttBox.setMaximumSize(COMBO_SIZE);    m_classAttBox.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {	m_classPanel.setCindex(m_classAttBox.getSelectedIndex());      }      });				        m_xAttBox.setMinimumSize(COMBO_SIZE);    m_xAttBox.setPreferredSize(COMBO_SIZE);    m_xAttBox.setMaximumSize(COMBO_SIZE);    m_yAttBox.setMinimumSize(COMBO_SIZE);    m_yAttBox.setPreferredSize(COMBO_SIZE);    m_yAttBox.setMaximumSize(COMBO_SIZE);    m_classPanel.setMinimumSize(new       Dimension((int)COMBO_SIZE.getWidth()*2, 		(int)COMBO_SIZE.getHeight()*2));    m_classPanel.setPreferredSize(new       Dimension((int)COMBO_SIZE.getWidth()*2, 		(int)COMBO_SIZE.getHeight()*2));    m_controlPanel = new JPanel();    m_controlPanel.setLayout(new BorderLayout());    JPanel cHolder = new JPanel();    cHolder.setBorder(BorderFactory.createTitledBorder("Class Attribute"));    cHolder.add(m_classAttBox);    JPanel vAttHolder = new JPanel();    vAttHolder.setLayout(new GridLayout(2,1));    vAttHolder.setBorder(BorderFactory.			 createTitledBorder("Visualization Attributes"));    vAttHolder.add(m_xAttBox);    vAttHolder.add(m_yAttBox);    JPanel colOne = new JPanel();    colOne.setLayout(new BorderLayout());    colOne.add(cHolder, BorderLayout.NORTH);    colOne.add(vAttHolder, BorderLayout.CENTER);    m_regionSamplesText.setBorder(BorderFactory.			    createTitledBorder("Num. samples per region"));    m_regionSamplesText.setBackground(colOne.getBackground());    m_generatorSamplesText.setBorder(BorderFactory.				     createTitledBorder("Base for sampling in "				     +"non-fixed dimensions"));    m_generatorSamplesText.setBackground(colOne.getBackground());    JPanel colTwo = new JPanel();    colTwo.setLayout(new BorderLayout());    colTwo.add(m_generatorSamplesText, BorderLayout.NORTH);    JPanel startPanel = new JPanel();    startPanel.setBorder(BorderFactory.			 createTitledBorder("Plotting"));    startPanel.setLayout(new BorderLayout());    startPanel.add(m_startBut, BorderLayout.CENTER);    startPanel.add(m_plotTrainingData, BorderLayout.WEST);    JPanel tempPanel = new JPanel();    tempPanel.setLayout(new BorderLayout());    tempPanel.add(m_regionSamplesText, BorderLayout.NORTH);    tempPanel.add(startPanel, BorderLayout.SOUTH);    colTwo.add(tempPanel, BorderLayout.SOUTH);    m_controlPanel.add(colOne, BorderLayout.WEST);    m_controlPanel.add(colTwo, BorderLayout.CENTER);    JPanel classHolder = new JPanel();    classHolder.setBorder(BorderFactory.createTitledBorder("Class color"));    classHolder.add(m_classPanel);    m_controlPanel.add(classHolder, BorderLayout.SOUTH);    add(m_controlPanel, BorderLayout.NORTH);    m_boundaryPanel = new BoundaryPanel(m_plotAreaWidth, m_plotAreaHeight);    m_numberOfSamplesFromEachRegion = m_boundaryPanel.getNumSamplesPerRegion();    m_regionSamplesText.setText(""+m_numberOfSamplesFromEachRegion);    m_generatorSamplesBase = (int)m_boundaryPanel.getGeneratorSamplesBase();    m_generatorSamplesText.setText(""+m_generatorSamplesBase);    m_boundaryPanel.setDataGenerator(new KDDataGenerator());    add(m_boundaryPanel, BorderLayout.CENTER);    m_xAxisPanel = new AxisPanel(false);    add(m_xAxisPanel, BorderLayout.SOUTH);    m_yAxisPanel = new AxisPanel(true);    add(m_yAxisPanel, BorderLayout.WEST);    m_startBut.setEnabled(false);    m_startBut.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  if (m_startBut.getText().equals("Start")) {	    if (m_trainingInstances != null && m_classifier != null) {	      try {		int tempSamples = m_numberOfSamplesFromEachRegion;		try {		  tempSamples = 		    Integer.parseInt(m_regionSamplesText.getText().trim());		} catch (Exception ex) {		  m_regionSamplesText.setText(""+tempSamples);		}		m_numberOfSamplesFromEachRegion = tempSamples;		m_boundaryPanel.		  setNumSamplesPerRegion(tempSamples);		tempSamples = m_generatorSamplesBase;		try {		  tempSamples = 		    Integer.parseInt(m_generatorSamplesText.getText().trim());		} catch (Exception ex) {		  m_generatorSamplesText.setText(""+tempSamples);		}		m_generatorSamplesBase = tempSamples;		m_boundaryPanel.setGeneratorSamplesBase((double)tempSamples);		m_trainingInstances.		  setClassIndex(m_classAttBox.getSelectedIndex());		m_boundaryPanel.setClassifier(m_classifier);		m_boundaryPanel.setTrainingData(m_trainingInstances);		m_boundaryPanel.setXAttribute(m_xIndex);		m_boundaryPanel.setYAttribute(m_yIndex);		m_boundaryPanel.		  setPlotTrainingData(m_plotTrainingData.isSelected());		m_boundaryPanel.start();		m_startBut.setText("Stop");		setControlEnabledStatus(false);	      } catch (Exception ex) {		ex.printStackTrace();	      }	    }	  } else {	    m_boundaryPanel.stopPlotting();	    m_startBut.setText("Start");	    setControlEnabledStatus(true);	  }	}      });    m_boundaryPanel.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  m_startBut.setText("Start");	  setControlEnabledStatus(true);	}      });    m_classPanel.addActionListener(new ActionListener() {	public void actionPerformed(ActionEvent e) {	  m_boundaryPanel.replot();	}      });  }