Package java.awt

Examples of java.awt.AWTEvent


    protected void fireActionPerformed()
    {
        if (m_actionListenersArray != null && !m_actionListenersArray.isEmpty())
        {
            AWTEvent event = EventQueue.getCurrentEvent();
            int modifier = 0;
            if (event instanceof InputEvent)
                modifier = ((InputEvent)event).getModifiers();
            else if (event instanceof ActionEvent)
                modifier = ((ActionEvent)event).getModifiers();
View Full Code Here


    void dispose() {
        if (this.frame != null) {
            MainFrame frame = this.frame;
            this.frame = null;
            AWTEvent e = new WindowEvent(frame, WindowEvent.WINDOW_CLOSING);
            Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
        }
    }
View Full Code Here

    source.destroy();
  }

  @Test
  public void should_return_true_if_Window_closed() {
    AWTEvent event = new WindowEvent(source, WINDOW_CLOSED);
    assertThat(AWTEvents.wasWindowClosed(event)).isTrue();
  }
View Full Code Here

    assertThat(AWTEvents.wasWindowClosed(event)).isTrue();
  }

  @Test
  public void should_return_false_if_Window_not_closed() {
    AWTEvent event = new WindowEvent(source, WINDOW_CLOSING);
    assertThat(AWTEvents.wasWindowClosed(event)).isFalse();
  }
View Full Code Here

    source.destroy();
  }

  @Test
  public void should_return_true_if_Window_shown() {
    AWTEvent event = new ComponentEvent(source, COMPONENT_SHOWN);
    assertThat(AWTEvents.wasWindowShown(event)).isTrue();
  }
View Full Code Here

    assertThat(AWTEvents.wasWindowShown(event)).isTrue();
  }

  @Test
  public void should_return_false_if_Component_shown_is_not_Window() {
    AWTEvent event = new ComponentEvent(label().createNew(), COMPONENT_SHOWN);
    assertThat(AWTEvents.wasWindowShown(event)).isFalse();
  }
View Full Code Here

    assertThat(AWTEvents.wasWindowShown(event)).isFalse();
  }

  @Test
  public void should_return_false_if_Window_not_shown() {
    AWTEvent event = new ComponentEvent(source, COMPONENT_HIDDEN);
    assertThat(AWTEvents.wasWindowShown(event)).isFalse();
  }
View Full Code Here

  /** {@inheritDoc} */
  @RunsInEDT
  @Override
  public void eventDispatched(AWTEvent event) {
    AWTEvent e = checkNotNull(event);
    if (wasWindowOpened(e) || wasWindowShown(e)) {
      Window w = sourceOf(e);
      if (w != null) {
        filter(w);
      }
View Full Code Here

    assertThat(toolkit.contains(listener, EVENT_MASK)).isTrue();
  }

  @Test
  public void should_dispatch_events_to_wrapped_EventListener() {
    AWTEvent event = singletonAWTEventMock();
    listener.eventDispatched(event);
    assertThat(underlying.dispatchedEvent).isSameAs(event);
  }
View Full Code Here

      // order, but they will likely be from different event dispatch contexts, so it shouldn't matter.
      queue.addAll(deferredEvents);
      deferredEvents.clear();
    }
    while (queue.size() > 0) {
      AWTEvent event = queue.get(0);
      queue.remove(0);
      processEvent(checkNotNull(event));
    }
  }
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.