27 import java.awt.event.*; |
27 import java.awt.event.*; |
28 import java.io.*; |
28 import java.io.*; |
29 |
29 |
30 /** |
30 /** |
31 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
31 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
32 * available only for backwards compatilibility. It has been replaced |
32 * available only for backwards compatibility. It has been replaced |
33 * by the <code>AWTEvent</code> class and its subclasses. |
33 * by the <code>AWTEvent</code> class and its subclasses. |
34 * <p> |
34 * <p> |
35 * <code>Event</code> is a platform-independent class that |
35 * <code>Event</code> is a platform-independent class that |
36 * encapsulates events from the platform's Graphical User |
36 * encapsulates events from the platform's Graphical User |
37 * Interface in the Java 1.0 event model. In Java 1.1 |
37 * Interface in the Java 1.0 event model. In Java 1.1 |
38 * and later versions, the <code>Event</code> class is maintained |
38 * and later versions, the <code>Event</code> class is maintained |
39 * only for backwards compatibilty. The information in this |
39 * only for backwards compatibility. The information in this |
40 * class description is provided to assist programmers in |
40 * class description is provided to assist programmers in |
41 * converting Java 1.0 programs to the new event model. |
41 * converting Java 1.0 programs to the new event model. |
42 * <p> |
42 * <p> |
43 * In the Java 1.0 event model, an event contains an |
43 * In the Java 1.0 event model, an event contains an |
44 * {@link Event#id} field |
44 * {@link Event#id} field |
388 public static final int SCROLL_PAGE_DOWN = 4 + SCROLL_EVENT; |
388 public static final int SCROLL_PAGE_DOWN = 4 + SCROLL_EVENT; |
389 |
389 |
390 /** |
390 /** |
391 * The user has moved the bubble (thumb) in a scroll bar, |
391 * The user has moved the bubble (thumb) in a scroll bar, |
392 * moving to an "absolute" position, rather than to |
392 * moving to an "absolute" position, rather than to |
393 * an offset from the last postion. |
393 * an offset from the last position. |
394 */ |
394 */ |
395 public static final int SCROLL_ABSOLUTE = 5 + SCROLL_EVENT; |
395 public static final int SCROLL_ABSOLUTE = 5 + SCROLL_EVENT; |
396 |
396 |
397 /** |
397 /** |
398 * The scroll begin event. |
398 * The scroll begin event. |
607 */ |
607 */ |
608 private static native void initIDs(); |
608 private static native void initIDs(); |
609 |
609 |
610 /** |
610 /** |
611 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
611 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
612 * available only for backwards compatilibility. It has been replaced |
612 * available only for backwards compatibility. It has been replaced |
613 * by the <code>AWTEvent</code> class and its subclasses. |
613 * by the <code>AWTEvent</code> class and its subclasses. |
614 * <p> |
614 * <p> |
615 * Creates an instance of <code>Event</code> with the specified target |
615 * Creates an instance of <code>Event</code> with the specified target |
616 * component, time stamp, event type, <i>x</i> and <i>y</i> |
616 * component, time stamp, event type, <i>x</i> and <i>y</i> |
617 * coordinates, keyboard key, state of the modifier keys, and |
617 * coordinates, keyboard key, state of the modifier keys, and |
658 } |
658 } |
659 } |
659 } |
660 |
660 |
661 /** |
661 /** |
662 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
662 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
663 * available only for backwards compatilibility. It has been replaced |
663 * available only for backwards compatibility. It has been replaced |
664 * by the <code>AWTEvent</code> class and its subclasses. |
664 * by the <code>AWTEvent</code> class and its subclasses. |
665 * <p> |
665 * <p> |
666 * Creates an instance of <code>Event</code>, with the specified target |
666 * Creates an instance of <code>Event</code>, with the specified target |
667 * component, time stamp, event type, <i>x</i> and <i>y</i> |
667 * component, time stamp, event type, <i>x</i> and <i>y</i> |
668 * coordinates, keyboard key, state of the modifier keys, and an |
668 * coordinates, keyboard key, state of the modifier keys, and an |
679 this(target, when, id, x, y, key, modifiers, null); |
679 this(target, when, id, x, y, key, modifiers, null); |
680 } |
680 } |
681 |
681 |
682 /** |
682 /** |
683 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
683 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
684 * available only for backwards compatilibility. It has been replaced |
684 * available only for backwards compatibility. It has been replaced |
685 * by the <code>AWTEvent</code> class and its subclasses. |
685 * by the <code>AWTEvent</code> class and its subclasses. |
686 * <p> |
686 * <p> |
687 * Creates an instance of <code>Event</code> with the specified |
687 * Creates an instance of <code>Event</code> with the specified |
688 * target component, event type, and argument. |
688 * target component, event type, and argument. |
689 * @param target the target component. |
689 * @param target the target component. |
694 this(target, 0, id, 0, 0, 0, 0, arg); |
694 this(target, 0, id, 0, 0, 0, 0, arg); |
695 } |
695 } |
696 |
696 |
697 /** |
697 /** |
698 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
698 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
699 * available only for backwards compatilibility. It has been replaced |
699 * available only for backwards compatibility. It has been replaced |
700 * by the <code>AWTEvent</code> class and its subclasses. |
700 * by the <code>AWTEvent</code> class and its subclasses. |
701 * <p> |
701 * <p> |
702 * Translates this event so that its <i>x</i> and <i>y</i> |
702 * Translates this event so that its <i>x</i> and <i>y</i> |
703 * coordinates are increased by <i>dx</i> and <i>dy</i>, |
703 * coordinates are increased by <i>dx</i> and <i>dy</i>, |
704 * respectively. |
704 * respectively. |
715 this.y += dy; |
715 this.y += dy; |
716 } |
716 } |
717 |
717 |
718 /** |
718 /** |
719 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
719 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
720 * available only for backwards compatilibility. It has been replaced |
720 * available only for backwards compatibility. It has been replaced |
721 * by the <code>AWTEvent</code> class and its subclasses. |
721 * by the <code>AWTEvent</code> class and its subclasses. |
722 * <p> |
722 * <p> |
723 * Checks if the Shift key is down. |
723 * Checks if the Shift key is down. |
724 * @return <code>true</code> if the key is down; |
724 * @return <code>true</code> if the key is down; |
725 * <code>false</code> otherwise. |
725 * <code>false</code> otherwise. |
731 return (modifiers & SHIFT_MASK) != 0; |
731 return (modifiers & SHIFT_MASK) != 0; |
732 } |
732 } |
733 |
733 |
734 /** |
734 /** |
735 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
735 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
736 * available only for backwards compatilibility. It has been replaced |
736 * available only for backwards compatibility. It has been replaced |
737 * by the <code>AWTEvent</code> class and its subclasses. |
737 * by the <code>AWTEvent</code> class and its subclasses. |
738 * <p> |
738 * <p> |
739 * Checks if the Control key is down. |
739 * Checks if the Control key is down. |
740 * @return <code>true</code> if the key is down; |
740 * @return <code>true</code> if the key is down; |
741 * <code>false</code> otherwise. |
741 * <code>false</code> otherwise. |
747 return (modifiers & CTRL_MASK) != 0; |
747 return (modifiers & CTRL_MASK) != 0; |
748 } |
748 } |
749 |
749 |
750 /** |
750 /** |
751 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
751 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
752 * available only for backwards compatilibility. It has been replaced |
752 * available only for backwards compatibility. It has been replaced |
753 * by the <code>AWTEvent</code> class and its subclasses. |
753 * by the <code>AWTEvent</code> class and its subclasses. |
754 * <p> |
754 * <p> |
755 * Checks if the Meta key is down. |
755 * Checks if the Meta key is down. |
756 * |
756 * |
757 * @return <code>true</code> if the key is down; |
757 * @return <code>true</code> if the key is down; |
782 } |
782 } |
783 } |
783 } |
784 |
784 |
785 /** |
785 /** |
786 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
786 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
787 * available only for backwards compatilibility. It has been replaced |
787 * available only for backwards compatibility. It has been replaced |
788 * by the <code>AWTEvent</code> class and its subclasses. |
788 * by the <code>AWTEvent</code> class and its subclasses. |
789 */ |
789 */ |
790 boolean isConsumed() { |
790 boolean isConsumed() { |
791 return consumed; |
791 return consumed; |
792 } |
792 } |
793 |
793 |
794 /* |
794 /* |
795 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
795 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
796 * available only for backwards compatilibility. It has been replaced |
796 * available only for backwards compatibility. It has been replaced |
797 * by the <code>AWTEvent</code> class and its subclasses. |
797 * by the <code>AWTEvent</code> class and its subclasses. |
798 * <p> |
798 * <p> |
799 * Returns the integer key-code associated with the key in this event, |
799 * Returns the integer key-code associated with the key in this event, |
800 * as described in java.awt.Event. |
800 * as described in java.awt.Event. |
801 */ |
801 */ |
809 return (int)e.getKeyChar(); |
809 return (int)e.getKeyChar(); |
810 } |
810 } |
811 |
811 |
812 /* |
812 /* |
813 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
813 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
814 * available only for backwards compatilibility. It has been replaced |
814 * available only for backwards compatibility. It has been replaced |
815 * by the <code>AWTEvent</code> class and its subclasses. |
815 * by the <code>AWTEvent</code> class and its subclasses. |
816 * <p> |
816 * <p> |
817 * Returns a new KeyEvent char which corresponds to the int key |
817 * Returns a new KeyEvent char which corresponds to the int key |
818 * of this old event. |
818 * of this old event. |
819 */ |
819 */ |
826 return (char)key; |
826 return (char)key; |
827 } |
827 } |
828 |
828 |
829 /** |
829 /** |
830 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
830 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
831 * available only for backwards compatilibility. It has been replaced |
831 * available only for backwards compatibility. It has been replaced |
832 * by the <code>AWTEvent</code> class and its subclasses. |
832 * by the <code>AWTEvent</code> class and its subclasses. |
833 * <p> |
833 * <p> |
834 * Returns a string representing the state of this <code>Event</code>. |
834 * Returns a string representing the state of this <code>Event</code>. |
835 * This method is intended to be used only for debugging purposes, and the |
835 * This method is intended to be used only for debugging purposes, and the |
836 * content and format of the returned string may vary between |
836 * content and format of the returned string may vary between |
862 return str; |
862 return str; |
863 } |
863 } |
864 |
864 |
865 /** |
865 /** |
866 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
866 * <b>NOTE:</b> The <code>Event</code> class is obsolete and is |
867 * available only for backwards compatilibility. It has been replaced |
867 * available only for backwards compatibility. It has been replaced |
868 * by the <code>AWTEvent</code> class and its subclasses. |
868 * by the <code>AWTEvent</code> class and its subclasses. |
869 * <p> |
869 * <p> |
870 * Returns a representation of this event's values as a string. |
870 * Returns a representation of this event's values as a string. |
871 * @return a string that represents the event and the values |
871 * @return a string that represents the event and the values |
872 * of its member fields. |
872 * of its member fields. |