public void actionPerformed(ActionEvent e){
		if(e.getSource().equals(timer)){
		model.updatePositions();
		view.update();
		timeCounter += (int)timer.getDelay();
		if(record){
			try {
				skrivfil();
				} catch (IOException e1) {}
			}
		}
		if(e.getSource().equals(recordButton)){
			if(!record){record=true;
			} else {
				record=false; 
				try{
					outputStream.close();
					} catch (IOException e1) {}
				}
		}
		if(e.getSource().equals(simulationButton)){
			if(!timer.isRunning()){timer.start();} else {timer.stop();}
		}
		if(e.getSource().equals(crystallizeButton)){
			model.changeCrystallize();
		}
	}