1 16 package com.buchuki.ensmer.input.event; 17 18 import java.awt.event.*; 19 20 28 public class EnsmerKeyEvent extends EnsmerInputEvent { 29 30 38 public EnsmerKeyEvent(int keycode) { 39 this.keycode = keycode; 40 } 41 42 49 public EnsmerKeyEvent(KeyEvent event) { 50 super(event); 51 this.keycode = event.getKeyCode(); 52 } 53 54 62 @Override 63 public boolean equals(Object obj) { 64 if (getClass().equals(obj.getClass())) { 65 EnsmerKeyEvent ob = (EnsmerKeyEvent) obj; 66 return (ob.getKeyCode() == -1 || keycode == -1 || ob.getKeyCode() == keycode); 67 } 68 else { 69 return false; 70 } 71 } 72 73 81 @Override 82 public int hashCode() { 83 return keycode + getClass().hashCode(); 84 } 85 86 92 public int getKeyCode() { 93 return keycode; 94 } 95 96 99 private int keycode; 100 } 101 | Popular Tags |