1 16 package com.buchuki.ensmer.input; 17 18 import java.awt.*; 19 import java.awt.event.*; 20 import com.buchuki.ensmer.input.event.*; 21 22 28 public class InputEventConverter implements MouseListener, MouseMotionListener, MouseWheelListener, KeyListener { 29 30 38 public InputEventConverter(InputProcessor processor, Component comp) { 39 this.processor = processor; 40 comp.addMouseListener(this); 41 comp.addMouseMotionListener(this); 42 comp.addMouseWheelListener(this); 43 comp.addKeyListener(this); 44 } 45 46 51 public void mouseClicked(MouseEvent e) { } 52 53 58 public void mouseEntered(MouseEvent e) { } 59 60 65 public void mouseExited(MouseEvent e) { } 66 67 72 public void mousePressed(MouseEvent e) { 73 processor.processInput(new MousePressEvent(e)); 74 } 75 76 81 public void mouseReleased(MouseEvent e) { 82 processor.processInput(new MouseReleaseEvent(e)); 83 } 84 85 91 public void mouseDragged(MouseEvent e) { 92 processor.processInput(new MouseMoveEvent(e)); 93 } 94 95 100 public void mouseMoved(MouseEvent e) { 101 processor.processInput(new MouseMoveEvent(e)); 102 } 103 104 109 public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) { 110 processor.processInput(new com.buchuki.ensmer.input.event.MouseWheelEvent(e)); 111 } 112 113 118 public void keyTyped(KeyEvent e) { } 119 120 125 public void keyPressed(KeyEvent e) { 126 processor.processInput(new KeyPressEvent(e)); 127 } 128 129 134 public void keyReleased(KeyEvent e) { 135 processor.processInput(new KeyReleaseEvent(e)); 136 } 137 138 141 private InputProcessor processor; 142 } 143 144 | Popular Tags |