Class NEWTEvent

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    InputEvent, OutputEvent, WindowEvent

    public class NEWTEvent
    extends EventObject
    NEWT events are provided for notification purposes ONLY;
    The NEWT will automatically handle the event semantics internally, regardless of whether a program is receiving these events or not.
    The actual event semantic is processed before the event is send.
    Event type registry:
    • WindowEvent 100..10x
    • MouseEvent 200..20x
    • KeyEvent 300..30x
    • GestureEvent 400..5xx
    • MonitorEvent 600..60x

    See Also:
    Serialized Form
    • Method Detail

      • getEventType

        public final short getEventType()
        Returns the event type of this event.
      • getWhen

        public final long getWhen()
        Returns the timestamp, in milliseconds, of this event.
      • setAttachment

        public final void setAttachment​(Object attachment)
        Attach the passed object to this event.
        If an object was previously attached, it will be replaced.
        Attachments to NEWT events allow users to pass on information from one custom listener to another, ie custom listener to listener communication.
        Parameters:
        attachment - User application specific object
      • getAttachment

        public final Object getAttachment()
        Returns:
        The user application specific attachment, or null
      • isConsumed

        public final boolean isConsumed()
        Returns true if this events has been consumed, otherwise false.
        See Also:
        setConsumed(boolean)
      • setConsumed

        public final void setConsumed​(boolean consumed)
        If consumed is true, this event is marked as consumed, ie. the event will not be propagated any further to potential other event listener. Otherwise the event will be propagated to other event listener, the default.

        The event is marked as being consumed while attaching the consumedTag.

        Events with platform specific actions will be supressed if marked as consumed. Examples are:

      • toHexString

        public static String toHexString​(short hex)