Mercurial > hg > Database > Alice
view src/alice/test/topology/aquarium/KeyInputCodeSegment.java @ 134:53aff28cde6b working
change package
author | sugi |
---|---|
date | Wed, 15 Aug 2012 17:11:57 +0900 |
parents | src/alice/test/topology/fishmodel/alpha/KeyInputCodeSegment.java@a8f77957a477 |
children | 87f1a30a8c82 |
line wrap: on
line source
package alice.test.topology.aquarium; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; public class KeyInputCodeSegment implements KeyListener{ int KeyCode = 0; SendLocation cs; String key; public void setKey(){ } @Override public void keyPressed(KeyEvent event) { KeyCode = event.getKeyCode(); //System.out.println("getKey" +KeyCode); switch(KeyCode) { case 37: cs = new SendLocation(-0.1f,0.0f); cs.position.setKey("local", "fish"); break; case 39: cs = new SendLocation(0.1f,0.0f); cs.position.setKey("local", "fish"); break; case 40: cs = new SendLocation(0.0f,-0.1f); cs.position.setKey("local", "fish"); break; case 38: cs = new SendLocation(0.0f,0.1f); cs.position.setKey("local", "fish"); break; } } @Override public void keyReleased(KeyEvent arg0) { } @Override public void keyTyped(KeyEvent arg0) { } }