Mercurial > hg > Database > Alice
view src/alice/test/topology/aquarium/KeyInputCodeSegment.java @ 143:0651fb36a369 working
demo for Open Source Conference
author | sugi |
---|---|
date | Thu, 20 Sep 2012 22:44:11 +0900 |
parents | b51d3bf971e7 |
children | e58794b067f5 |
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{ MakeFrame frame; public KeyInputCodeSegment(MakeFrame frame) { this.frame = frame; } @Override public void keyPressed(KeyEvent event) { //System.out.println(event.getKeyCode()); switch(event.getKeyCode()) { case 37: // left new SendLocation(-0.1f,0.0f); break; case 38: // up new SendLocation(0.0f,0.1f); break; case 39: // right new SendLocation(0.1f,0.0f); break; case 40: // down new SendLocation(0.0f,-0.1f); break; case 82: // "r" new RefreshWindow(frame); break; } } @Override public void keyReleased(KeyEvent event) { } @Override public void keyTyped(KeyEvent event) { } }