1 18 package org.apache.batik.gvt.event; 19 20 import java.awt.event.InputEvent ; 21 22 import org.apache.batik.gvt.GraphicsNode; 23 24 30 public abstract class GraphicsNodeInputEvent extends GraphicsNodeEvent { 31 32 35 public static final int SHIFT_MASK = InputEvent.SHIFT_MASK; 36 37 40 public static final int CTRL_MASK = InputEvent.CTRL_MASK; 41 42 45 public static final int META_MASK = InputEvent.META_MASK; 46 47 50 public static final int ALT_MASK = InputEvent.ALT_MASK; 51 52 55 public static final int ALT_GRAPH_MASK = InputEvent.ALT_GRAPH_MASK; 56 57 60 public static final int BUTTON1_MASK = InputEvent.BUTTON1_MASK; 61 62 65 public static final int BUTTON2_MASK = InputEvent.ALT_MASK; 66 67 70 public static final int BUTTON3_MASK = InputEvent.META_MASK; 71 72 77 long when; 78 79 83 int modifiers; 84 85 92 protected GraphicsNodeInputEvent(GraphicsNode source, int id, 93 long when, int modifiers) { 94 super(source, id); 95 this.when = when; 96 this.modifiers = modifiers; 97 } 98 99 104 protected GraphicsNodeInputEvent(GraphicsNode source, InputEvent evt) { 105 super(source, evt.getID()); 106 this.when = evt.getWhen(); 107 this.modifiers = evt.getModifiers(); 108 } 109 110 113 public boolean isShiftDown() { 114 return (modifiers & SHIFT_MASK) != 0; 115 } 116 117 120 public boolean isControlDown() { 121 return (modifiers & CTRL_MASK) != 0; 122 } 123 124 127 public boolean isMetaDown() { 128 return (modifiers & META_MASK) != 0; 129 } 130 131 134 public boolean isAltDown() { 135 return (modifiers & ALT_MASK) != 0; 136 } 137 138 141 public boolean isAltGraphDown() { 142 return (modifiers & ALT_GRAPH_MASK) != 0; 143 } 144 145 148 public long getWhen() { 149 return when; 150 } 151 152 155 public int getModifiers() { 156 return modifiers; 157 } 158 } 159 | Popular Tags |