Package java.awt

Examples of java.awt.AWTEvent$EventDescriptor


    listener = new EmergencyAbortListener(singletonToolkitMock(), terminator);
  }

  @Test
  public void should_not_terminate_tests_if_event_id_is_not_KeyPressed() {
    AWTEvent event = newAWTEventMock();
    int eventId = KEY_PRESSED + 1;
    when(event.getID()).thenReturn(eventId);
    listener.eventDispatched(event);
    verifyZeroInteractions(terminator);
  }
View Full Code Here


    verifyZeroInteractions(terminator);
  }

  @Test
  public void should_not_terminate_tests_if_event_is_not_KeyEvent() {
    AWTEvent event = newAWTEventMock();
    when(event.getID()).thenReturn(KEY_PRESSED);
    listener.eventDispatched(event);
    verifyZeroInteractions(terminator);
  }
View Full Code Here

    source.destroy();
  }

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

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

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

    /* This method lifted from JTextComponent.java
     */
    private int getCurrentEventModifiers() {
        int modifiers = 0;
        AWTEvent currentEvent = EventQueue.getCurrentEvent();
        if (currentEvent instanceof InputEvent) {
            modifiers = ((InputEvent) currentEvent).getModifiers();
        } else if (currentEvent instanceof ActionEvent) {
            modifiers = ((ActionEvent) currentEvent).getModifiers();
        }
View Full Code Here

    protected void fireActionPerformed(String command) {
        // Guaranteed to return a non-null array
        Object[] listeners = listenerList.getListenerList();
        long mostRecentEventTime = EventQueue.getMostRecentEventTime();
        int modifiers = 0;
        AWTEvent currentEvent = EventQueue.getCurrentEvent();
        if (currentEvent instanceof InputEvent) {
            modifiers = ((InputEvent)currentEvent).getModifiers();
        } else if (currentEvent instanceof ActionEvent) {
            modifiers = ((ActionEvent)currentEvent).getModifiers();
        }
View Full Code Here

     *
     * @param action DOCUMENT ME!
     */
    protected void fireAction(ActionListener action) {
        int      modifiers    = 0;
        AWTEvent currentEvent = EventQueue.getCurrentEvent();

        if (currentEvent instanceof InputEvent) {
            modifiers = ((InputEvent) currentEvent).getModifiers();
        } else if (currentEvent instanceof ActionEvent) {
            modifiers = ((ActionEvent) currentEvent).getModifiers();
View Full Code Here

            // different event dispatch contexts, so it shouldn't matter.
            queue.addAll(deferredEvents);
            deferredEvents.clear();
        }
        while (queue.size() > 0) {
            AWTEvent prev = null;
            Log.debug("processing deferred event");
            // Process any events that were generated
            prev = (AWTEvent)queue.get(0);
            queue.remove(0);
            processEvent(prev);
View Full Code Here

      if (e.getSource() instanceof JScrollBar &&
          ((JScrollBar)e.getSource()).getParent() instanceof JScrollPane) {

        // TF:04/09/2009:We only want to post the event if we're currently processing either a keyboard or mouse event. Otherwise
        // we can fire listener events when the window is resized (unlike Forte). We can only do this if we are not adjusting.
        AWTEvent currentEvent = GlassPaneWithEvents.getCurrentEvent();
        if ((currentEvent instanceof MouseEvent || currentEvent instanceof KeyEvent) && !e.getValueIsAdjusting()) {
        // TF:31 Oct 2008:Don't post the event if we're in the process of laying out.
        Component source = ((JScrollPane)((JScrollBar)e.getSource()).getParent()).getViewport().getView();
        RepaintManager manager = RepaintManager.currentManager(source);
        if (!(manager instanceof ForteRepaintManager && ((ForteRepaintManager)manager).isValidating())) {
View Full Code Here

            try {
                Thread.sleep(20);
            } catch (InterruptedException e) {}
            UIutils.invokeOnGuiThread(new Runnable() {
                public void run() {
                    AWTEvent e = Toolkit.getDefaultToolkit().getSystemEventQueue().peekEvent();
                    holder.setBoolean(e != null);
                }
            });
        } while (holder.getBoolean());
View Full Code Here

TOP

Related Classes of java.awt.AWTEvent$EventDescriptor

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.