Examples of KeyEvent


Examples of java.awt.event.KeyEvent

    /**
     * For attending Ctrl+Key events in graph window to launch context menu actions
     */
    public void eventDispatched(AWTEvent event) {
        KeyEvent evt = (KeyEvent) event;

        if (evt.getID() == KeyEvent.KEY_RELEASED && (evt.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) == KeyEvent.CTRL_DOWN_MASK) {
            final ContextMenuItemManipulator item = keyActionMappings.get(evt.getKeyCode());
            if (item != null) {
                ((GraphContextMenuItem) item).setup(eventBridge.getGraph(), eventBridge.getSelectedNodes());
                if (item.isAvailable() && item.canExecute()) {
                    DataLaboratoryHelper.getDefault().executeManipulator(item);
                }
                evt.consume();
            }
        }
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

    public synchronized KeyEvent waitKey(int delay) {
        try {
            keyEvent = null;
            wait(delay);
        } catch (InterruptedException ex) { }
        KeyEvent e = keyEvent;
        keyEvent = null;
        return e;
    }
View Full Code Here

Examples of java.awt.event.KeyEvent

        }
    }

    private void updateControlState(AWTEvent event) {
        if (event instanceof KeyEvent) {
            KeyEvent key = (KeyEvent) event;
            int code = key.getKeyCode();
            if (code == controlKeyCode) {
                if (key.getID() == KeyEvent.KEY_PRESSED) {
                    isControlOn = ! isControlOn;
                    if (isControlOn) {
                        listener.eventDispatched(TapStartEvent);
                    }
                    else {
View Full Code Here

Examples of java.awt.event.KeyEvent

    verify(windows).markAsReady(window);
  }

  @Test
  public void should_not_mark_source_Window_as_ready_if_event_is_not_MouseEvent() {
    monitor.eventDispatched(new KeyEvent(window, 8, 9238, 0, 0, 'a'));
    verifyZeroInteractions(windows);
  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    this.modifier = modifier;
  }

  @Test
  public void should_return_true_if_modifiers_match() {
    KeyEvent e = keyEventWithModifiers(modifier);
    assertThat(InputModifiers.modifiersMatch(e, modifier)).isTrue();
  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    assertThat(InputModifiers.modifiersMatch(e, modifier)).isTrue();
  }

  @Test
  public void _return_false_if_modifiers_do_not_match() {
    KeyEvent e = keyEventWithModifiers(0);
    assertThat(InputModifiers.modifiersMatch(e, modifier)).isFalse();
  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    KeyEvent e = keyEventWithModifiers(0);
    assertThat(InputModifiers.modifiersMatch(e, modifier)).isFalse();
  }

  private static KeyEvent keyEventWithModifiers(int modifiers) {
    return new KeyEvent(singletonComponentMock(), 0, 0, modifiers, VK_A, 'a');
  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    verifyZeroInteractions(terminator);
  }

  @Test
  public void should_not_terminate_tests_if_key_code_does_not_match() {
    KeyEvent event = new KeyEvent(button().createNew(), KEY_PRESSED, 0, 0, VK_Z, 'Z');
    listener.eventDispatched(event);
    verifyZeroInteractions(terminator);
  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    verifyZeroInteractions(terminator);
  }

  @Test
  public void should_not_terminate_tests_if_modifiers_do_not_match() {
    KeyEvent event = new KeyEvent(button().createNew(), KEY_PRESSED, 0, 0, VK_A, 'A');
    listener.eventDispatched(event);
    verifyZeroInteractions(terminator);
  }
View Full Code Here

Examples of java.awt.event.KeyEvent

    verifyZeroInteractions(terminator);
  }

  @Test
  public void should_terminate_tests_if_key_combination_matches() {
    KeyEvent event = new KeyEvent(button().createNew(), KEY_PRESSED, 0, CTRL_MASK | SHIFT_MASK, VK_A, 'A');
    listener.eventDispatched(event);
    verify(terminator).terminateTests();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.