Package java.awt

Examples of java.awt.AWTKeyStroke


  /**
   * Some checks for the equals() method.
   */
  public void test(TestHarness harness)
  {
    AWTKeyStroke ks1 = AWTKeyStroke.getAWTKeyStroke('A');
    AWTKeyStroke ks2 = AWTKeyStroke.getAWTKeyStroke('A');
    harness.check(ks1.equals(ks2));
   
    harness.check(!ks1.equals(null));
    harness.check(!ks1.equals(new Integer(42)));
   
View Full Code Here


  }
 
  private void testMethod1(TestHarness harness)
  {
    harness.checkPoint("(char)");   
    AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke('s');
    harness.check(ks.getKeyEventType(), KeyEvent.KEY_TYPED);
    harness.check(ks.getKeyChar(), 's');
    harness.check(ks.getModifiers(), 0);
    harness.check(ks.isOnKeyRelease(), false);
  }
View Full Code Here

  }

  private void testMethod2(TestHarness harness)
  {
    harness.checkPoint("(Character, int)");   
    AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke(new Character('s'), InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
    harness.check(ks.getKeyEventType(), KeyEvent.KEY_TYPED);
    harness.check(ks.getKeyChar(), 's');
    harness.check(ks.getModifiers(), InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK);
    harness.check(ks.isOnKeyRelease(), false);

    // check for IllegalArgumentException for null argument
    try
    {
      ks = AWTKeyStroke.getAWTKeyStroke(null, 0);
View Full Code Here

  }

  private void testMethod3(TestHarness harness)
  {
    harness.checkPoint("(int, int)");   
    AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK);
    harness.check(ks.getKeyEventType(), KeyEvent.KEY_PRESSED);
    harness.check(ks.getKeyChar(), KeyEvent.CHAR_UNDEFINED);
    harness.check(ks.getModifiers(), InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK);
    harness.check(ks.isOnKeyRelease(), false);
  }
View Full Code Here

  }

  private void testMethod4(TestHarness harness)
  {
    harness.checkPoint("(int, int, boolean)");   
    AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK, true);
    harness.check(ks.getKeyEventType(), KeyEvent.KEY_RELEASED);
    harness.check(ks.getKeyChar(), KeyEvent.CHAR_UNDEFINED);
    harness.check(ks.getModifiers(), InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK);
    harness.check(ks.isOnKeyRelease(), true);
  }
View Full Code Here

  private void testMethod5(TestHarness harness)
  {
    harness.checkPoint("(String)");   
   
    AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke("INSERT");
    AWTKeyStroke expected = AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_INSERT, 0);
    harness.check(ks, expected);
   
    ks = AWTKeyStroke.getAWTKeyStroke("control DELETE");
    expected = AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_DOWN_MASK);
    harness.check(ks, expected);
View Full Code Here

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    AWTKeyStroke ks1 = AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK, true);
    AWTKeyStroke ks2 = null;

    try {
      ByteArrayOutputStream buffer = new ByteArrayOutputStream();
      ObjectOutput out = new ObjectOutputStream(buffer);
      out.writeObject(ks1);
View Full Code Here

       
        // Ignore events outside this frame
        if (frame.isFocused()) {
            Set traverseForwardKeys = frame.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
            Set traverseBackwardKeys = frame.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
            AWTKeyStroke key = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
           
            if (!pendingTraverseOut) {
                // We haven't started to traverse out yet. Check to see if the traversal key has been
                // hit and that we are at the last/first compoent in the traversal group.
               
View Full Code Here

    public void processKeyEvent(Component focusedComponent, KeyEvent e) {
        if (e.getID() == KeyEvent.KEY_PRESSED && focusedComponent.getFocusTraversalKeysEnabled() && !e.isConsumed())
        {
            this.handleArrowKeys(focusedComponent, e);

            AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
            AWTKeyStroke oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(),
                                                    stroke.getModifiers(),
                                                    !stroke.isOnKeyRelease());
            Set<AWTKeyStroke> toTest;
            boolean reasonSet = false;
View Full Code Here

    public void processKeyEvent(Component focusedComponent, KeyEvent e) {
        if (e.getID() == KeyEvent.KEY_PRESSED && focusedComponent.getFocusTraversalKeysEnabled() && !e.isConsumed())
        {
            this.handleArrowKeys(focusedComponent, e);

            AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
            AWTKeyStroke oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(),
                                                    stroke.getModifiers(),
                                                    !stroke.isOnKeyRelease());
            Set<AWTKeyStroke> toTest;
            boolean reasonSet = false;
View Full Code Here

TOP

Related Classes of java.awt.AWTKeyStroke

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.