public void tick(Graphics g)
	{
		if(step(manual))//this performs checks on whether the machine is started, and regulates the speed of the animation
		{
			//setting manual to false so that only one step will be executed each time the animation is stepped.
			manual = false;
			switch(next)
			{
			case 0://deactivate all transitions (which in-turn activate their target states)
				for(int i = active.size()-1; 0 <= i; --i)
				{
					if(active.elementAt(i) instanceof Transition)
						active.elementAt(i).deactivate(-1, active);
				}
				next = 1;
				break;
			case 1://read a symbol and deactivate all states (which in turn activate their transitions with the symbol read)
				if(test())
					break;
				int read = input.elementAt(0);
				input.removeElementAt(0);
				for(int i = active.size()-1; 0 <= i; --i)
					active.elementAt(i).deactivate(read, active);
				next = 0;
				break;
			}
		}
		//the following occur ever tick regardless of whether the machine is running.
		g.setColor(Color.WHITE);
		//draw the input string and the savedInput in the upper left corner.
		g.drawString(input.toString(), 10, 15);
		g.drawString(savedInput.toString(), 10, 30);
		//ask all the states to paint themselves.
		for(State s: machineStates)
			s.paint(g);
	}