1 26 27 package net.sourceforge.groboutils.uicapture.v1.event; 28 29 import java.awt.Robot ; 30 import java.awt.event.InputEvent ; 31 32 33 39 public abstract class CaptureEvent implements java.io.Serializable 40 { 41 public static final int CE_MOUSE_MOVED = 1; 42 public static final int CE_MOUSE_PRESSED = 2; 43 public static final int CE_MOUSE_RELEASED = 3; 44 public static final int CE_KEY_PRESSED = 4; 45 public static final int CE_KEY_RELEASED = 5; 46 public static final int CE_MOUSE_WHEEL = 6; 47 48 51 private int eventType = -1; 52 53 56 private InputEvent event = null; 57 58 61 private long timeOfEvent = -1; 62 63 64 67 public CaptureEvent( int eventType, InputEvent event ) 68 { 69 this.eventType = eventType; 70 this.event = event; 71 if (event != null) 72 { 73 this.timeOfEvent = event.getWhen(); 74 } 75 } 76 77 78 81 public CaptureEvent( int eventType ) 82 { 83 this.eventType = eventType; 84 this.event = null; 85 this.timeOfEvent = -1; 86 } 87 88 89 public int getEventType() 90 { 91 return this.eventType; 92 } 93 94 95 public InputEvent getInputEvent() 96 { 97 return this.event; 98 } 99 100 101 public long getTimeOfEvent() 102 { 103 return this.timeOfEvent; 104 } 105 106 107 111 public abstract void performEvent( Robot r ); 112 } 113 114 | Popular Tags |