1. /*
  2. * @(#)Event.java 1.68 00/02/02
  3. *
  4. * Copyright 1995-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.awt;
  11. import java.awt.event.*;
  12. import java.io.*;
  13. /**
  14. * <code>Event</code> is a platform-independent class that
  15. * encapsulates events from the platform's Graphical User
  16. * Interface in the Java 1.0 event model. In Java 1.1
  17. * and later versions, the <code>Event</code> class is maintained
  18. * only for backwards compatibilty. The information in this
  19. * class description is provided to assist programmers in
  20. * converting Java 1.0 programs to the new event model.
  21. * <p>
  22. * In the Java 1.0 event model, an event contains an
  23. * {@link Event#id} field
  24. * that indicates what type of event it is and which other
  25. * <code>Event</code> variables are relevant for the event.
  26. * <p>
  27. * For keyboard events, {@link Event#key}
  28. * contains a value indicating which key was activated, and
  29. * {@link Event#modifiers} contains the
  30. * modifiers for that event. For the KEY_PRESS and KEY_RELEASE
  31. * event ids, the value of <code>key</code> is the unicode
  32. * character code for the key. For KEY_ACTION and
  33. * KEY_ACTION_RELEASE, the value of <code>key</code> is
  34. * one of the defined action-key identifiers in the
  35. * <code>Event</code> class (<code>PGUP</code>,
  36. * <code>PGDN</code>, <code>F1</code>, <code>F2</code>, etc).
  37. *
  38. * @version 1.68 02/02/00
  39. * @author Sami Shaio
  40. * @since JDK1.0
  41. */
  42. public class Event implements java.io.Serializable {
  43. private transient long data;
  44. /* Modifier constants */
  45. /**
  46. * This flag indicates that the Shift key was down when the event
  47. * occurred.
  48. */
  49. public static final int SHIFT_MASK = 1 << 0;
  50. /**
  51. * This flag indicates that the Control key was down when the event
  52. * occurred.
  53. */
  54. public static final int CTRL_MASK = 1 << 1;
  55. /**
  56. * This flag indicates that the Meta key was down when the event
  57. * occurred. For mouse events, this flag indicates that the right
  58. * button was pressed or released.
  59. */
  60. public static final int META_MASK = 1 << 2;
  61. /**
  62. * This flag indicates that the Alt key was down when
  63. * the event occurred. For mouse events, this flag indicates that the
  64. * middle mouse button was pressed or released.
  65. */
  66. public static final int ALT_MASK = 1 << 3;
  67. /* Action keys */
  68. /**
  69. * The Home key, a non-ASCII action key.
  70. */
  71. public static final int HOME = 1000;
  72. /**
  73. * The End key, a non-ASCII action key.
  74. */
  75. public static final int END = 1001;
  76. /**
  77. * The Page Up key, a non-ASCII action key.
  78. */
  79. public static final int PGUP = 1002;
  80. /**
  81. * The Page Down key, a non-ASCII action key.
  82. */
  83. public static final int PGDN = 1003;
  84. /**
  85. * The Up Arrow key, a non-ASCII action key.
  86. */
  87. public static final int UP = 1004;
  88. /**
  89. * The Down Arrow key, a non-ASCII action key.
  90. */
  91. public static final int DOWN = 1005;
  92. /**
  93. * The Left Arrow key, a non-ASCII action key.
  94. */
  95. public static final int LEFT = 1006;
  96. /**
  97. * The Right Arrow key, a non-ASCII action key.
  98. */
  99. public static final int RIGHT = 1007;
  100. /**
  101. * The F1 function key, a non-ASCII action key.
  102. */
  103. public static final int F1 = 1008;
  104. /**
  105. * The F2 function key, a non-ASCII action key.
  106. */
  107. public static final int F2 = 1009;
  108. /**
  109. * The F3 function key, a non-ASCII action key.
  110. */
  111. public static final int F3 = 1010;
  112. /**
  113. * The F4 function key, a non-ASCII action key.
  114. */
  115. public static final int F4 = 1011;
  116. /**
  117. * The F5 function key, a non-ASCII action key.
  118. */
  119. public static final int F5 = 1012;
  120. /**
  121. * The F6 function key, a non-ASCII action key.
  122. */
  123. public static final int F6 = 1013;
  124. /**
  125. * The F7 function key, a non-ASCII action key.
  126. */
  127. public static final int F7 = 1014;
  128. /**
  129. * The F8 function key, a non-ASCII action key.
  130. */
  131. public static final int F8 = 1015;
  132. /**
  133. * The F9 function key, a non-ASCII action key.
  134. */
  135. public static final int F9 = 1016;
  136. /**
  137. * The F10 function key, a non-ASCII action key.
  138. */
  139. public static final int F10 = 1017;
  140. /**
  141. * The F11 function key, a non-ASCII action key.
  142. */
  143. public static final int F11 = 1018;
  144. /**
  145. * The F12 function key, a non-ASCII action key.
  146. */
  147. public static final int F12 = 1019;
  148. /**
  149. * The Print Screen key, a non-ASCII action key.
  150. */
  151. public static final int PRINT_SCREEN = 1020;
  152. /**
  153. * The Scroll Lock key, a non-ASCII action key.
  154. */
  155. public static final int SCROLL_LOCK = 1021;
  156. /**
  157. * The Caps Lock key, a non-ASCII action key.
  158. */
  159. public static final int CAPS_LOCK = 1022;
  160. /**
  161. * The Num Lock key, a non-ASCII action key.
  162. */
  163. public static final int NUM_LOCK = 1023;
  164. /**
  165. * The Pause key, a non-ASCII action key.
  166. */
  167. public static final int PAUSE = 1024;
  168. /**
  169. * The Insert key, a non-ASCII action key.
  170. */
  171. public static final int INSERT = 1025;
  172. /* Non-action keys */
  173. /**
  174. * The Enter key.
  175. */
  176. public static final int ENTER = '\n';
  177. /**
  178. * The BackSpace key.
  179. */
  180. public static final int BACK_SPACE = '\b';
  181. /**
  182. * The Tab key.
  183. */
  184. public static final int TAB = '\t';
  185. /**
  186. * The Escape key.
  187. */
  188. public static final int ESCAPE = 27;
  189. /**
  190. * The Delete key.
  191. */
  192. public static final int DELETE = 127;
  193. /* Base for all window events. */
  194. private static final int WINDOW_EVENT = 200;
  195. /**
  196. * The user has asked the window manager to kill the window.
  197. */
  198. public static final int WINDOW_DESTROY = 1 + WINDOW_EVENT;
  199. /**
  200. * The user has asked the window manager to expose the window.
  201. */
  202. public static final int WINDOW_EXPOSE = 2 + WINDOW_EVENT;
  203. /**
  204. * The user has asked the window manager to iconify the window.
  205. */
  206. public static final int WINDOW_ICONIFY = 3 + WINDOW_EVENT;
  207. /**
  208. * The user has asked the window manager to de-iconify the window.
  209. */
  210. public static final int WINDOW_DEICONIFY = 4 + WINDOW_EVENT;
  211. /**
  212. * The user has asked the window manager to move the window.
  213. */
  214. public static final int WINDOW_MOVED = 5 + WINDOW_EVENT;
  215. /* Base for all keyboard events. */
  216. private static final int KEY_EVENT = 400;
  217. /**
  218. * The user has pressed a normal key.
  219. */
  220. public static final int KEY_PRESS = 1 + KEY_EVENT;
  221. /**
  222. * The user has released a normal key.
  223. */
  224. public static final int KEY_RELEASE = 2 + KEY_EVENT;
  225. /**
  226. * The user has pressed a non-ASCII <em>action</em> key.
  227. * The <code>key</code> field contains a value that indicates
  228. * that the event occurred on one of the action keys, which
  229. * comprise the 12 function keys, the arrow (cursor) keys,
  230. * Page Up, Page Down, Home, End, Print Screen, Scroll Lock,
  231. * Caps Lock, Num Lock, Pause, and Insert.
  232. */
  233. public static final int KEY_ACTION = 3 + KEY_EVENT;
  234. /**
  235. * The user has released a non-ASCII <em>action</em> key.
  236. * The <code>key</code> field contains a value that indicates
  237. * that the event occurred on one of the action keys, which
  238. * comprise the 12 function keys, the arrow (cursor) keys,
  239. * Page Up, Page Down, Home, End, Print Screen, Scroll Lock,
  240. * Caps Lock, Num Lock, Pause, and Insert.
  241. */
  242. public static final int KEY_ACTION_RELEASE = 4 + KEY_EVENT;
  243. /* Base for all mouse events. */
  244. private static final int MOUSE_EVENT = 500;
  245. /**
  246. * The user has pressed the mouse button. The <code>ALT_MASK</code>
  247. * flag indicates that the middle button has been pressed.
  248. * The <code>META_MASK</code>flag indicates that the
  249. * right button has been pressed.
  250. * @see java.awt.Event#ALT_MASK
  251. * @see java.awt.Event#META_MASK
  252. */
  253. public static final int MOUSE_DOWN = 1 + MOUSE_EVENT;
  254. /**
  255. * The user has released the mouse button. The <code>ALT_MASK</code>
  256. * flag indicates that the middle button has been released.
  257. * The <code>META_MASK</code>flag indicates that the
  258. * right button has been released.
  259. * @see java.awt.Event#ALT_MASK
  260. * @see java.awt.Event#META_MASK
  261. */
  262. public static final int MOUSE_UP = 2 + MOUSE_EVENT;
  263. /**
  264. * The mouse has moved with no button pressed.
  265. */
  266. public static final int MOUSE_MOVE = 3 + MOUSE_EVENT;
  267. /**
  268. * The mouse has entered a component.
  269. */
  270. public static final int MOUSE_ENTER = 4 + MOUSE_EVENT;
  271. /**
  272. * The mouse has exited a component.
  273. */
  274. public static final int MOUSE_EXIT = 5 + MOUSE_EVENT;
  275. /**
  276. * The user has moved the mouse with a button pressed. The
  277. * <code>ALT_MASK</code> flag indicates that the middle
  278. * button is being pressed. The <code>META_MASK</code> flag indicates
  279. * that the right button is being pressed.
  280. * @see java.awt.Event#ALT_MASK
  281. * @see java.awt.Event#META_MASK
  282. */
  283. public static final int MOUSE_DRAG = 6 + MOUSE_EVENT;
  284. /* Scrolling events */
  285. private static final int SCROLL_EVENT = 600;
  286. /**
  287. * The user has activated the <em>line up</em>
  288. * area of a scroll bar.
  289. */
  290. public static final int SCROLL_LINE_UP = 1 + SCROLL_EVENT;
  291. /**
  292. * The user has activated the <em>line down</em>
  293. * area of a scroll bar.
  294. */
  295. public static final int SCROLL_LINE_DOWN = 2 + SCROLL_EVENT;
  296. /**
  297. * The user has activated the <em>page up</em>
  298. * area of a scroll bar.
  299. */
  300. public static final int SCROLL_PAGE_UP = 3 + SCROLL_EVENT;
  301. /**
  302. * The user has activated the <em>page down</em>
  303. * area of a scroll bar.
  304. */
  305. public static final int SCROLL_PAGE_DOWN = 4 + SCROLL_EVENT;
  306. /**
  307. * The user has moved the bubble (thumb) in a scroll bar,
  308. * moving to an "absolute" position, rather than to
  309. * an offset from the last postion.
  310. */
  311. public static final int SCROLL_ABSOLUTE = 5 + SCROLL_EVENT;
  312. /**
  313. * The scroll begin event.
  314. */
  315. public static final int SCROLL_BEGIN = 6 + SCROLL_EVENT;
  316. /**
  317. * The scroll end event.
  318. */
  319. public static final int SCROLL_END = 7 + SCROLL_EVENT;
  320. /* List Events */
  321. private static final int LIST_EVENT = 700;
  322. /**
  323. * An item in a list has been selected.
  324. */
  325. public static final int LIST_SELECT = 1 + LIST_EVENT;
  326. /**
  327. * An item in a list has been deselected.
  328. */
  329. public static final int LIST_DESELECT = 2 + LIST_EVENT;
  330. /* Misc Event */
  331. private static final int MISC_EVENT = 1000;
  332. /**
  333. * This event indicates that the user wants some action to occur.
  334. */
  335. public static final int ACTION_EVENT = 1 + MISC_EVENT;
  336. /**
  337. * A file loading event.
  338. */
  339. public static final int LOAD_FILE = 2 + MISC_EVENT;
  340. /**
  341. * A file saving event.
  342. */
  343. public static final int SAVE_FILE = 3 + MISC_EVENT;
  344. /**
  345. * A component gained the focus.
  346. */
  347. public static final int GOT_FOCUS = 4 + MISC_EVENT;
  348. /**
  349. * A component lost the focus.
  350. */
  351. public static final int LOST_FOCUS = 5 + MISC_EVENT;
  352. /**
  353. * The target component. This indicates the component over which the
  354. * event occurred or with which the event is associated.
  355. * This object has been replaced by AWTEvent.getSource()
  356. *
  357. * @serial
  358. * @see java.awt.AWTEvent#getSource()
  359. */
  360. public Object target;
  361. /**
  362. * The time stamp.
  363. * Replaced by InputEvent.getWhen().
  364. *
  365. * @serial
  366. * @see java.awt.event.InputEvent#getWhen()
  367. */
  368. public long when;
  369. /**
  370. * Indicates which type of event the event is, and which
  371. * other <code>Event</code> variables are relevant for the event.
  372. * This has been replaced by AWTEvent.getID()
  373. *
  374. * @serial
  375. * @see java.awt.AWTEvent#getID()
  376. */
  377. public int id;
  378. /**
  379. * The <i>x</i> coordinate of the event.
  380. * Replaced by MouseEvent.getX()
  381. *
  382. * @serial
  383. * @see java.awt.event.MouseEvent#getX()
  384. */
  385. public int x;
  386. /**
  387. * The <i>y</i> coordinate of the event.
  388. * Replaced by MouseEvent.getY()
  389. *
  390. * @serial
  391. * @see java.awt.event.MouseEvent#getY()
  392. */
  393. public int y;
  394. /**
  395. * The key code of the key that was pressed in a keyboard event.
  396. * This has been replaced by KeyEvent.getKeyCode()
  397. *
  398. * @serial
  399. * @see java.awt.event.KeyEvent#getKeyCode()
  400. */
  401. public int key;
  402. /**
  403. * The key character that was pressed in a keyboard event.
  404. */
  405. // public char keyChar;
  406. /**
  407. * The state of the modifier keys.
  408. * This is replaced with InputEvent.getModifiers()
  409. * In java 1.1 MouseEvent and KeyEvent are subclasses
  410. * of InputEvent.
  411. *
  412. * @serial
  413. * @see java.awt.event.InputEvent#getModifiers()
  414. */
  415. public int modifiers;
  416. /**
  417. * For <code>MOUSE_DOWN</code> events, this field indicates the
  418. * number of consecutive clicks. For other events, its value is
  419. * <code>0</code>.
  420. * This field has been replaced by MouseEvent.getClickCount().
  421. *
  422. * @serial
  423. * @see java.awt.event.MouseEvent#getClickCount().
  424. */
  425. public int clickCount;
  426. /**
  427. * An arbitrary argument of the event. The value of this field
  428. * depends on the type of event.
  429. * <code>arg</code> has been replaced b event specific property.
  430. *
  431. * @serial
  432. */
  433. public Object arg;
  434. /**
  435. * The next event. This field is set when putting events into a
  436. * linked list.
  437. * This has been replaced by EventQueue.
  438. *
  439. * @serial
  440. * @see java.awt.EventQueue
  441. */
  442. public Event evt;
  443. /* table for mapping old Event action keys to KeyEvent virtual keys. */
  444. private static final int actionKeyCodes[][] = {
  445. /* virtual key action key */
  446. { KeyEvent.VK_HOME, Event.HOME },
  447. { KeyEvent.VK_END, Event.END },
  448. { KeyEvent.VK_PAGE_UP, Event.PGUP },
  449. { KeyEvent.VK_PAGE_DOWN, Event.PGDN },
  450. { KeyEvent.VK_UP, Event.UP },
  451. { KeyEvent.VK_DOWN, Event.DOWN },
  452. { KeyEvent.VK_LEFT, Event.LEFT },
  453. { KeyEvent.VK_RIGHT, Event.RIGHT },
  454. { KeyEvent.VK_F1, Event.F1 },
  455. { KeyEvent.VK_F2, Event.F2 },
  456. { KeyEvent.VK_F3, Event.F3 },
  457. { KeyEvent.VK_F4, Event.F4 },
  458. { KeyEvent.VK_F5, Event.F5 },
  459. { KeyEvent.VK_F6, Event.F6 },
  460. { KeyEvent.VK_F7, Event.F7 },
  461. { KeyEvent.VK_F8, Event.F8 },
  462. { KeyEvent.VK_F9, Event.F9 },
  463. { KeyEvent.VK_F10, Event.F10 },
  464. { KeyEvent.VK_F11, Event.F11 },
  465. { KeyEvent.VK_F12, Event.F12 },
  466. { KeyEvent.VK_PRINTSCREEN, Event.PRINT_SCREEN },
  467. { KeyEvent.VK_SCROLL_LOCK, Event.SCROLL_LOCK },
  468. { KeyEvent.VK_CAPS_LOCK, Event.CAPS_LOCK },
  469. { KeyEvent.VK_NUM_LOCK, Event.NUM_LOCK },
  470. { KeyEvent.VK_PAUSE, Event.PAUSE },
  471. { KeyEvent.VK_INSERT, Event.INSERT }
  472. };
  473. /**
  474. * This field controls whether or not the event is sent back
  475. * down to the peer once the target has processed it -
  476. * false means it's sent to the peer, true means it's not.
  477. *
  478. * @serial
  479. * @see isConsumed()
  480. */
  481. private boolean consumed = false;
  482. /*
  483. * JDK 1.1 serialVersionUID
  484. */
  485. private static final long serialVersionUID = 5488922509400504703L;
  486. static {
  487. /* ensure that the necessary native libraries are loaded */
  488. Toolkit.loadLibraries();
  489. initIDs();
  490. }
  491. /**
  492. * Initialize JNI field and method IDs for fields that may be
  493. accessed from C.
  494. */
  495. private static native void initIDs();
  496. /**
  497. * Creates an instance of <code>Event</code> with the specified target
  498. * component, time stamp, event type, <i>x</i> and <i>y</i>
  499. * coordinates, keyboard key, state of the modifier keys, and
  500. * argument.
  501. * @param target the target component.
  502. * @param when the time stamp.
  503. * @param id the event type.
  504. * @param x the <i>x</i> coordinate.
  505. * @param y the <i>y</i> coordinate.
  506. * @param key the key pressed in a keyboard event.
  507. * @param modifiers the state of the modifier keys.
  508. * @param arg the specified argument.
  509. */
  510. public Event(Object target, long when, int id, int x, int y, int key,
  511. int modifiers, Object arg) {
  512. this.target = target;
  513. this.when = when;
  514. this.id = id;
  515. this.x = x;
  516. this.y = y;
  517. this.key = key;
  518. this.modifiers = modifiers;
  519. this.arg = arg;
  520. this.data = 0;
  521. this.clickCount = 0;
  522. switch(id) {
  523. case ACTION_EVENT:
  524. case WINDOW_DESTROY:
  525. case WINDOW_ICONIFY:
  526. case WINDOW_DEICONIFY:
  527. case WINDOW_MOVED:
  528. case SCROLL_LINE_UP:
  529. case SCROLL_LINE_DOWN:
  530. case SCROLL_PAGE_UP:
  531. case SCROLL_PAGE_DOWN:
  532. case SCROLL_ABSOLUTE:
  533. case SCROLL_BEGIN:
  534. case SCROLL_END:
  535. case LIST_SELECT:
  536. case LIST_DESELECT:
  537. consumed = true; // these types are not passed back to peer
  538. break;
  539. default:
  540. }
  541. }
  542. /**
  543. * Creates an instance of <code>Event</code>, with the specified target
  544. * component, time stamp, event type, <i>x</i> and <i>y</i>
  545. * coordinates, keyboard key, state of the modifier keys, and an
  546. * argument set to <code>null</code>.
  547. * @param target the target component.
  548. * @param when the time stamp.
  549. * @param id the event type.
  550. * @param x the <i>x</i> coordinate.
  551. * @param y the <i>y</i> coordinate.
  552. * @param key the key pressed in a keyboard event.
  553. * @param modifiers the state of the modifier keys.
  554. */
  555. public Event(Object target, long when, int id, int x, int y, int key, int modifiers) {
  556. this(target, when, id, x, y, key, modifiers, null);
  557. }
  558. /**
  559. * Creates an instance of <code>Event</code> with the specified
  560. * target component, event type, and argument.
  561. * @param target the target component.
  562. * @param id the event type.
  563. * @param arg the specified argument.
  564. */
  565. public Event(Object target, int id, Object arg) {
  566. this(target, 0, id, 0, 0, 0, 0, arg);
  567. }
  568. /**
  569. * Translates this event so that its <i>x</i> and <i>y</i>
  570. * coordinates are increased by <i>dx</i> and <i>dy</i>,
  571. * respectively.
  572. * <p>
  573. * This method translates an event relative to the given component.
  574. * This involves, at a minimum, translating the coordinates into the
  575. * local coordinate system of the given component. It may also involve
  576. * translating a region in the case of an expose event.
  577. * @param dx the distance to translate the <i>x</i> coordinate.
  578. * @param dy the distance to translate the <i>y</i> coordinate.
  579. */
  580. public void translate(int x, int y) {
  581. this.x += x;
  582. this.y += y;
  583. }
  584. /**
  585. * Checks if the Shift key is down.
  586. * @return <code>true</code> if the key is down;
  587. * <code>false</code> otherwise.
  588. * @see java.awt.Event#modifiers
  589. * @see java.awt.Event#controlDown
  590. * @see java.awt.Event#metaDown
  591. */
  592. public boolean shiftDown() {
  593. return (modifiers & SHIFT_MASK) != 0;
  594. }
  595. /**
  596. * Checks if the Control key is down.
  597. * @return <code>true</code> if the key is down;
  598. * <code>false</code> otherwise.
  599. * @see java.awt.Event#modifiers
  600. * @see java.awt.Event#shiftDown
  601. * @see java.awt.Event#metaDown
  602. */
  603. public boolean controlDown() {
  604. return (modifiers & CTRL_MASK) != 0;
  605. }
  606. /**
  607. * Checks if the Meta key is down.
  608. * @return <code>true</code> if the key is down;
  609. * <code>false</code> otherwise.
  610. * @see java.awt.Event#modifiers
  611. * @see java.awt.Event#shiftDown
  612. * @see java.awt.Event#controlDown
  613. */
  614. public boolean metaDown() {
  615. return (modifiers & META_MASK) != 0;
  616. }
  617. void consume() {
  618. switch(id) {
  619. case KEY_PRESS:
  620. case KEY_RELEASE:
  621. case KEY_ACTION:
  622. case KEY_ACTION_RELEASE:
  623. consumed = true;
  624. break;
  625. default:
  626. // event type cannot be consumed
  627. }
  628. }
  629. boolean isConsumed() {
  630. return consumed;
  631. }
  632. /*
  633. * Returns the integer key-code associated with the key in this event,
  634. * as described in java.awt.Event.
  635. */
  636. static int getOldEventKey(KeyEvent e) {
  637. int keyCode = e.getKeyCode();
  638. for (int i = 0; i < actionKeyCodes.length; i++) {
  639. if (actionKeyCodes[i][0] == keyCode) {
  640. return actionKeyCodes[i][1];
  641. }
  642. }
  643. return (int)e.getKeyChar();
  644. }
  645. /*
  646. * Returns a new KeyEvent char which corresponds to the int key
  647. * of this old event.
  648. */
  649. char getKeyEventChar() {
  650. for (int i = 0; i < actionKeyCodes.length; i++) {
  651. if (actionKeyCodes[i][1] == key) {
  652. return KeyEvent.CHAR_UNDEFINED;
  653. }
  654. }
  655. return (char)key;
  656. }
  657. /**
  658. * Returns the parameter string representing this event.
  659. * This string is useful for debugging.
  660. * @return the parameter string of this event.
  661. */
  662. protected String paramString() {
  663. String str = "id=" + id + ",x=" + x + ",y=" + y;
  664. if (key != 0) {
  665. str += ",key=" + key;
  666. }
  667. if (shiftDown()) {
  668. str += ",shift";
  669. }
  670. if (controlDown()) {
  671. str += ",control";
  672. }
  673. if (metaDown()) {
  674. str += ",meta";
  675. }
  676. if (target != null) {
  677. str += ",target=" + target;
  678. }
  679. if (arg != null) {
  680. str += ",arg=" + arg;
  681. }
  682. return str;
  683. }
  684. /**
  685. * Returns a representation of this event's values as a string.
  686. * @return a string that represents the event and the values
  687. * of its member fields.
  688. * @see java.awt.Event#paramString
  689. * @since JDK1.1
  690. */
  691. public String toString() {
  692. return getClass().getName() + "[" + paramString() + "]";
  693. }
  694. }