diff src/alice/test/topology/movement/KeyInputCodeSegment.java @ 92:8e3c1217aad4 working

add KeyInput
author sugi
date Tue, 05 Jun 2012 14:31:04 +0900
parents
children 6601f8854126
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/alice/test/topology/movement/KeyInputCodeSegment.java	Tue Jun 05 14:31:04 2012 +0900
@@ -0,0 +1,38 @@
+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();
+		switch(KeyCode)
+		{
+		case 37:
+			cs = new SendLocation(-1);
+			cs.nowX.setKey("parent", "fish3X");
+			break;
+		case 39:
+			cs = new SendLocation(1);
+			cs.nowX.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
+		
+	}
+
+}