src/VirusSpreadSimulator.java
/**
	 * It is used to setup the canvas to our desired settings and sizes, setup events
	 */
It is used to setup the canvas to our desired settings and sizes, setup events
It is used to setup the canvas to our desired settings and sizes setup events
private void canvasSetup() {
		this.setSize(new Dimension(WIDTH, HEIGHT));
		this.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				int code = e.getKeyCode();
				if (code == KeyEvent.VK_R)
					city = new Location(getWidth(), getHeight(), new Hospital(), false, city.getPsize());
				if (code == KeyEvent.VK_M)
					runState = STATE.Set;
				if(code == KeyEvent.VK_Q) {
					if(city.getState()) 
						city.setState(false);
					else city.setState(true);;
				}
			}
		});
		this.addComponentListener(new ComponentAdapter() {
			public void componentResized(ComponentEvent componentEvent) {
				city.setSize(getWidth(), getHeight());
			}
		});
		this.setFocusable(true);
	}
private void canvasSetup ( ) { this . setSize ( new Dimension ( WIDTH , HEIGHT ) ) ; this . addKeyListener ( new KeyAdapter ( ) { @ Override public void keyPressed ( KeyEvent e ) { int code = e . getKeyCode ( ) ; if ( code == KeyEvent . VK_R ) city = new Location ( getWidth ( ) , getHeight ( ) , new Hospital ( ) , false , city . getPsize ( ) ) ; if ( code == KeyEvent . VK_M ) runState = STATE . Set ; if ( code == KeyEvent . VK_Q ) { if ( city . getState ( ) ) city . setState ( false ) ; else city . setState ( true ) ; ; } } } ) ; this . addComponentListener ( new ComponentAdapter ( ) { public void componentResized ( ComponentEvent componentEvent ) { city . setSize ( getWidth ( ) , getHeight ( ) ) ; } } ) ; this . setFocusable ( true ) ; }
It is used to setup the canvas to our desired settings and sizes, setup events
It is used to setup the canvas to our desired settings and sizes setup events
//		this.setMaximumSize(new Dimension(WIDTH, HEIGHT)); //		this.setMinimumSize(new Dimension(WIDTH, HEIGHT)); // refresh size of city when this canvas changes size