public void setInstances(Instances ins) throws Exception {
    if (ins.numAttributes() > 512) {
      throw new Exception("Can't display more than 512 attributes!");
    }

    if (m_span == null) {
      m_span = new JPanel() {
	  private static final long serialVersionUID = 7107576557995451922L;
	  
	  public void paintComponent(Graphics gx) {
	    super.paintComponent(gx);
	    gx.setColor(Color.red);
	    if (m_yIndex != m_xIndex) {
	      gx.drawString("X", 5, m_xIndex * 20 + 16);
	      gx.drawString("Y", 5, m_yIndex * 20 + 16);
	    }
	    else {
	      gx.drawString("B", 5, m_xIndex * 20 + 16);
	    }
	  }
	};
    }

    m_span.removeAll();
    m_plotInstances = ins;
    if (ins.numInstances() > 0 && ins.numAttributes() > 0) {
      JPanel padder = new JPanel();
      JPanel padd2 = new JPanel();
      
      /*    if (m_splitListener != null) {
	    m_plotInstances.randomize(new Random());
	    } */

      m_heights = new int[ins.numInstances()];

      m_cIndex = ins.numAttributes() - 1;
      for (int noa = 0; noa < ins.numInstances(); noa++) {
	m_heights[noa] = (int)(Math.random() * 19);
      }
      m_span.setPreferredSize(new Dimension(m_span.getPreferredSize().width, 
					    (m_cIndex + 1) * 20));
      m_span.setMaximumSize(new Dimension(m_span.getMaximumSize().width, 
					  (m_cIndex + 1) * 20));
      AttributeSpacing tmp;
      
      GridBagLayout gb = new GridBagLayout();
      GridBagLayout gb2 = new GridBagLayout();
      GridBagConstraints constraints = new GridBagConstraints();
      


      padder.setLayout(gb);
      m_span.setLayout(gb2);
      constraints.anchor = GridBagConstraints.CENTER;
      constraints.gridx=0;constraints.gridy=0;constraints.weightx=5;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.gridwidth=1;constraints.gridheight=1;
      constraints.insets = new Insets(0, 0, 0, 0);
      padder.add(m_span, constraints);
      constraints.gridx=0;constraints.gridy=1;constraints.weightx=5;
      constraints.fill = GridBagConstraints.BOTH;
      constraints.gridwidth=1;constraints.gridheight=1;constraints.weighty=5;
      constraints.insets = new Insets(0, 0, 0, 0);
      padder.add(padd2, constraints);
      constraints.weighty=0;
      setViewportView(padder);
      //getViewport().setLayout(null);
      //m_span.setMinimumSize(new Dimension(100, (m_cIndex + 1) * 24));
      //m_span.setSize(100, (m_cIndex + 1) * 24);
      constraints.anchor = GridBagConstraints.CENTER;
      constraints.gridx=0;constraints.gridy=0;constraints.weightx=5;
      constraints.fill = GridBagConstraints.HORIZONTAL;
      constraints.gridwidth=1;constraints.gridheight=1;constraints.weighty=5;
      constraints.insets = new Insets(2,20,2,4);

      for (int noa = 0; noa < ins.numAttributes(); noa++) {
	tmp = new AttributeSpacing(ins.attribute(noa), noa);
	 
	constraints.gridy = noa;
	m_span.add(tmp, constraints);
      }
    }
  }