package contents;

import javax.swing.JFrame;

import jp.ac.naka.ec.entity.AbstractEntity;
import jp.ac.naka.ec.entity.EntityEvent;

public class ParticlesEntity extends AbstractEntity {

	ParticleWindow win;
	@Override
	public void init() {
		win = new ParticleWindow();
		win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	@Override
	public void receiveMessage(EntityEvent evt) {
		String message = evt.getMessage();
		if (message != null && message.indexOf("value:") != -1) {
			int value = Integer.valueOf(message.substring("value:".length())) ;
			//System.out.println(value);
			win.changeValue(value);
		} 
		if (message.equals("reset"))
			win.reset();
	}
}
