public void actionPerformed(ActionEvent evt)
   {  

  double[] value= new double[7];
  String[] languages = new String[7];
  Color[] partycolours = new Color[7];
  String charttitle = "The Parties";

  Object source = evt.getSource();
  if (source == initBtn)
  {  
         int intizedouble = 0;
	for (int d=0; d<7; d++){
	intizedouble = (int) ((166.0/ 100.0) * percent2011[d]);
	prseats2011[d] = (double) intizedouble;
	intizedouble =  (int) (seats2011[d] - prseats2011[d]);
	bounce2011[d] = (double) intizedouble;
	}


	   displayMessage("initi\n");
   	   runSimBtn.setEnabled(true);
   	   graphBounceBtn.setEnabled(true);
   	   graphBtn.setEnabled(true);
	   
  }
  else if (source == yearsCombo)
{
	String str = (String)yearsCombo.getSelectedItem();
	displayMessage("now its " + str);


}
  else if (source == runSimBtn)
	  {
           System.out.println("Starting.. Run Sim.\n");
//  value[0] = 20;
  value[0] = -7.35;
  languages[0] = "Fianna Fail";
  partycolours[0] = Color.green;

//  value[1] = 76;
  value[1] = 9.68;
  languages[1] = "Fine Gael";
  partycolours[1] = Color.blue;

  //value[2] = 37;
  value[2] = 4.89;
  languages[2] = "Labour";
  partycolours[2] = Color.red;

  //value[3] = 14;
  value[3] = -1.47;
  languages[3] = "Sinn Fein";
  partycolours[3] = Color.yellow;

  //value[4] = 0;
  value[4] = -1.8;
  languages[4] = "Greens";
  partycolours[4] = Color.cyan;

//  value[5] = 5;
  value[5] = 0.51;
  languages[5] = "ULA";
  partycolours[5] = Color.magenta;
  
  //value[6] = 14;
  value[6] = -4.47;
  languages[6] = "Others";
  partycolours[6] = Color.gray;
/*  int intizedouble = 0;
 double[] seats2011 =  new double[]{20, 76, 37, 14, 0, 5, 14};
 double[] percent2011 =  new double[]{17.4, 36.1, 19.4,9.9, 1.8, 2.2, 12.1};
 double[] prseats2011 =  new double[]{20, 76, 37, 14, 5, 14, 0};
	for (int d=0; d<7; d++){
	intizedouble = (int) ((166.0/ 100.0) * percent2011[d]);
	prseats2011[d] = (double) intizedouble;
}*/


	 BarPlot.main(prseats2011, languages, partycolours,
    charttitle, true, 500, 400);



	  }

	  else if(source == aboutItem)
	  {
	//	  new AboutRelaxSim(this).show();
	  }
	else if(source == readmeItem)
	  {

	//	  new ReadMe(this).show();
	  }
 
         else if (source == graphBtn)
	 {
charttitle = "The Parties - Seats";

  value[0] = 20;
//  value[0] = -7.35;
  languages[0] = "Fianna Fail";
  partycolours[0] = Color.green;

  value[1] = 76;
  //value[1] = 9.68;
  languages[1] = "Fine Gael";
  partycolours[1] = Color.blue;

  value[2] = 37;
  //value[2] = 4.89;
  languages[2] = "Labour";
  partycolours[2] = Color.red;

  value[3] = 14;
  //value[3] = -1.47;
  languages[3] = "Sinn Fein";
  partycolours[3] = Color.yellow;

  value[4] = 0;
  //value[4] = -1.8;
  languages[4] = "Greens";
  partycolours[4] = Color.cyan;

  value[5] = 5;
//  value[5] = 0.51;
  languages[5] = "ULA";
  partycolours[5] = Color.magenta;
  
  value[6] = 14;
  //value[6] = -4.47;
  languages[6] = "Others";
  partycolours[6] = Color.gray;

	 BarPlot.main(value, languages, partycolours,
    charttitle,  true,500, 400);



		// plot contour map of the grid
	   //jahuwaldt.plot.EquiPlotWindow.main(grid, no_lines);
	   }

         else if (source == graphBounceBtn)
	 {
 charttitle =" The Parties electoral bounce";
//  value[0] = 20;
  value[0] = -7.35;
  languages[0] = "Fianna Fail";
  partycolours[0] = Color.green;

//  value[1] = 76;
  value[1] = 9.68;
  languages[1] = "Fine Gael";
  partycolours[1] = Color.blue;

  //value[2] = 37;
  value[2] = 4.89;
  languages[2] = "Labour";
  partycolours[2] = Color.red;

  //value[3] = 14;
  value[3] = -1.47;
  languages[3] = "Sinn Fein";
  partycolours[3] = Color.yellow;

  //value[4] = 0;
  value[4] = -1.8;
  languages[4] = "Greens";
  partycolours[4] = Color.cyan;

//  value[5] = 5;
  value[5] = 0.51;
  languages[5] = "ULA";
  partycolours[5] = Color.magenta;
  
  //value[6] = 14;
  value[6] = -4.47;
  languages[6] = "Others";
  partycolours[6] = Color.gray;


	 BarPlot.main(bounce2011, languages, partycolours,
    charttitle,  true,500, 400);

		// plot contour map of the grid
	   //jahuwaldt.plot.EquiPlotWindow.main(grid, no_lines);

	}

         else if (source == graphGrid)
	{
		// plot contour map of the grid
        	//jahuwaldt.plot.EquiPlotWindow.main(grid, no_lines);

	}

	  else
	  {
		  //  Util.debug("Unrecognised event");
	  }
      repaint();
   }