annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
1 package alice.test.topology.movement;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
2
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
3 import java.awt.event.KeyEvent;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
4 import java.awt.event.KeyListener;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
5
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
6 public class KeyInputCodeSegment implements KeyListener{
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
7 int KeyCode = 0;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
8 SendLocation cs;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
9 @Override
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
10 public void keyPressed(KeyEvent event) {
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
11 // TODO Auto-generated method stub
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
12 KeyCode = event.getKeyCode();
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
13 switch(KeyCode)
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
14 {
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
15 case 37:
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
16 cs = new SendLocation(-1);
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
17 cs.nowX.setKey("parent", "fish3X");
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
18 break;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
19 case 39:
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
20 cs = new SendLocation(1);
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
21 cs.nowX.setKey("parent", "fish3X");
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
22 break;
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
23 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
24 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
25
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
26 @Override
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
27 public void keyReleased(KeyEvent arg0) {
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
28 // TODO Auto-generated method stub
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
29
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
30 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
31
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
32 @Override
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
33 public void keyTyped(KeyEvent arg0) {
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
34 // TODO Auto-generated method stub
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
35
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
36 }
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
37
8e3c1217aad4 add KeyInput
sugi
parents:
diff changeset
38 }