src/VirusSpreadSimulator.java
/*
		 * Event Dispatch Thread: All swing related activities occurs in this thread. 
		 * Swingworker invokes the process() method.
		 * Updates the datapoints in the chart and repaints the chart.
		 */
Event Dispatch Thread: All swing related activities occurs in this thread.
Swingworker invokes the process() method.
Updates the datapoints in the chart and repaints the chart.
Event Dispatch Thread : All swing related activities occurs in this thread . Swingworker invokes the process () method . Updates the datapoints in the chart and repaints the chart .
@Override
		protected void process(List<double[]> chunks) {
			chart.updateXYSeries("Active Cases", null, infections, null);
			chart1.updateXYSeries("Patients", null, patients, null);	
			chart2.updateXYSeries("Deaths", null, deaths, null);
			sw.repaintChart();
			sw1.repaintChart();
			sw2.repaintChart();
			long start = System.currentTimeMillis();
			long duration = System.currentTimeMillis() - start;
			try {
				Thread.sleep(40 - duration); 
			} catch (InterruptedException e) {
			}
		}
@ Override protected void process ( List < double [ ] > chunks ) { chart . updateXYSeries ( "Active Cases" , null , infections , null ) ; chart1 . updateXYSeries ( "Patients" , null , patients , null ) ; chart2 . updateXYSeries ( "Deaths" , null , deaths , null ) ; sw . repaintChart ( ) ; sw1 . repaintChart ( ) ; sw2 . repaintChart ( ) ; long start = System . currentTimeMillis ( ) ; long duration = System . currentTimeMillis ( ) - start ; try { Thread . sleep ( 40 - duration ) ; } catch ( InterruptedException e ) { } }
Event Dispatch Thread: All swing related activities occurs in this thread.
Event Dispatch Thread : All swing related activities occurs in this thread .
// Update data points in the chart // Repaint the charts // 40 ms ==> 25fps // Thread.sleep(400 - duration); // 40 ms ==> 2.5fps