Package java.awt

Examples of java.awt.AWTEvent


          {
            if (EventQueue.isDispatchThread())
              {
                // The getNextEventMethod() issues wait() when no
                // event is available, so we don't need do explicitly wait().
                AWTEvent ev = queue.getNextEvent();
                // This mimics EventQueue.dispatchEvent(). We can't use
                // EventQueue.dispatchEvent() directly, because it is
                // protected, unfortunately.
                if (ev instanceof ActiveEvent)
                  ((ActiveEvent) ev).dispatch();
                else if (ev.getSource() instanceof Component)
                  ((Component) ev.getSource()).dispatchEvent(ev);
                else if (ev.getSource() instanceof MenuComponent)
                  ((MenuComponent) ev.getSource()).dispatchEvent(ev);
                // Other events are ignored as per spec in
                // EventQueue.dispatchEvent
              }
            else
              {
View Full Code Here


   */
  public boolean wasMouseClicked()
  {
    if ( currentEvt != null ) {
      if ( currentEvt instanceof AWTEvent ) {
        AWTEvent awtEvent = (AWTEvent)currentEvt;
        if ( ( awtEvent.getID() == MouseEvent.MOUSE_CLICKED ) ||
             ( ( awtEvent.getID() == MouseEvent.MOUSE_RELEASED ) &&
               ( awtEvent.getSource() == mouseDownComponent ) ) ) {
          mouseDownComponent = null;
          return true;
        }
      }
    }
View Full Code Here

   */
  public boolean wasMouseDoubleClicked()
  {
    if ( currentEvt != null ) {
      if ( currentEvt instanceof AWTEvent ) {
        AWTEvent awtEvent = (AWTEvent)currentEvt;
        if ( ( awtEvent.getID() == MouseEvent.MOUSE_CLICKED ) ||
             ( ( awtEvent.getID() == MouseEvent.MOUSE_RELEASED ) &&
               ( awtEvent.getSource() == mouseDownComponent ) ) &&
             (((MouseEvent)awtEvent ).getModifiers() & MouseEvent.BUTTON1_MASK ) != 0 &&
             (((MouseEvent)awtEvent ).getClickCount() == 2 ) ) {
          mouseDownComponent = null;
          return true;
        }
View Full Code Here

   */
  public boolean wasMouseRightClicked()
  {
    if ( currentEvt != null ) {
      if ( currentEvt instanceof AWTEvent ) {
        AWTEvent awtEvent = (AWTEvent)currentEvt;
        if (( awtEvent.getID() == MouseEvent.MOUSE_CLICKED ) ||
             ((awtEvent.getID() == MouseEvent.MOUSE_RELEASED ) &&
               (awtEvent.getSource() == mouseDownComponent ) ) &&
             (((MouseEvent )awtEvent ).getModifiers() & MouseEvent.BUTTON3_MASK ) != 0 ) {
          mouseDownComponent = null;
          return true;
        }
      }
View Full Code Here

  public void run()
  {
    while ( doDispatch ) {
      try {
        AWTEvent event = theQueue.getNextEvent();
        if ( false ) {
          // Not until 1.2...
          // theQueue.dispatchEvent(event);
        }
        else {
          // old code...
          Object src = event.getSource();
          if ( event instanceof ActiveEvent ) {
            // This could become the sole method of dispatching in time, and
            // moved to the event queue's dispatchEvent() method.
            ( (ActiveEvent)event ).dispatch();
          }
View Full Code Here

  public void run()
  {
    while ( doDispatch ) {
      try {
        AWTEvent event = theQueue.getNextEvent();
        if ( false ) {
          // Not until 1.2...
          // theQueue.dispatchEvent(event);
        }
        else {
          // old code...
          Object src = event.getSource();
          if ( event instanceof ActiveEvent ) {
            // This could become the sole method of dispatching in time, and
            // moved to the event queue's dispatchEvent() method.
            ( ( ActiveEvent )event ).dispatch();
          }
View Full Code Here

  public void run()
  {
    while ( doDispatch ) {
      try {
        AWTEvent event = theQueue.getNextEvent();
        if ( false ) {
          // Not until 1.2...
          // theQueue.dispatchEvent(event);
        }
        else {
          // old code...
          Object src = event.getSource();
          if ( event instanceof ActiveEvent ) {
            // This could become the sole method of dispatching in time, and
            // moved to the event queue's dispatchEvent() method.
            ( ( ActiveEvent )event ).dispatch();
          }
View Full Code Here

  waiter.setTimeoutsToCloneOf(timeouts, "QueueTool.WaitQueueEmptyTimeout");
  waiter.setOutput(output);
  try {
      waiter.waitAction(null);
  } catch(TimeoutExpiredException e) {
            final AWTEvent event = getQueue().peekEvent();
            // if event != null run toString in dispatch thread
            String eventToString = (event == null) ? "null" : (String)invokeSmoothly(
                new QueueTool.QueueAction("event.toString()") {
                    public Object launch() {
                        return event.toString();
                    }
                }
            );
            getOutput().printErrLine("Event at the top of stack: " + eventToString);
            throw(e);
View Full Code Here

  waiter.setTimeoutsToCloneOf(timeouts, "QueueTool.WaitQueueEmptyTimeout");
  waiter.setOutput(output);
  try {
      waiter.waitAction(null);
  } catch(TimeoutExpiredException e) {
            final AWTEvent event = getQueue().peekEvent();
            String eventToString = (event == null) ? "null" : (String)invokeSmoothly(
            new QueueTool.QueueAction("event.toString()") {
                public Object launch() {
                    return event.toString();
                }
            }
            );
            getOutput().printErrLine("Event at the top of stack: " + eventToString);
            throw(e);
View Full Code Here

            AppContext.stopEventDispatchThreads();
        }
    }

    static AWTEvent getShutdownEvent() {
        return new AWTEvent(getInstance(), 0) {};
    }
View Full Code Here

TOP

Related Classes of java.awt.AWTEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.