view src/alice/test/topology/movement/KeyInputCodeSegment.java @ 97:df786bf8f036 working

add FishPoint.java and Test
author sugi
date Tue, 26 Jun 2012 16:48:09 +0900
parents 6601f8854126
children 21e68300e205
line wrap: on
line source

package alice.test.topology.movement;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class KeyInputCodeSegment implements KeyListener{
	int KeyCode = 0;
	SendLocation cs; 
	@Override
	public void keyPressed(KeyEvent event) {
		// TODO Auto-generated method stub
		KeyCode = event.getKeyCode();
		System.out.println("getKey" +KeyCode);
		switch(KeyCode)
		{
		case 37:
			cs = new SendLocation(-0.1f,0.0f);
			cs.position.setKey("parent", "fish3X");
			break;
		case 39:
			cs = new SendLocation(0.1f,0.0f);
			cs.position.setKey("parent", "fish3X");
			break;
		case 40:
			cs = new SendLocation(0.0f,-0.1f);
			cs.position.setKey("parent", "fish3X");
			break;
		case 38:
			cs = new SendLocation(0.0f,0.1f);
			cs.position.setKey("parent", "fish3X");
			break;
		}
	}

	@Override
	public void keyReleased(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void keyTyped(KeyEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}