Package java.awt

Examples of java.awt.Robot


  public void test (TestHarness harness)
  {
    // default constructor
    try
      {
  Robot r = new Robot ();
      }
    catch (AWTException e)
      {
  harness.fail ("caught AWT exception: " + e.getMessage ());
      }
View Full Code Here


  // throwpoint: java.awt.Robot-Robot()
  harness.checkPoint("0-arg constructor");
  try {
    sm.prepareChecks(createRobot, readProperty);
    new Robot();
    sm.checkAllChecked();
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
  }

  // throwpoint: java.awt.Robot-Robot(GraphicsDevice)
  harness.checkPoint("1-arg constructor");
  try {
    sm.prepareChecks(createRobot, readProperty);
    new Robot(gd);
    sm.checkAllChecked();
  }
  catch (SecurityException ex) {
    harness.debug(ex);
    harness.check(false, "unexpected check");
View Full Code Here

    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    bounds.x += i.left + loc.x;
    bounds.y += i.top + loc.y;
   
    Robot r = harness.createRobot();
    LocationTests.checkRectangleCornerColors(harness, r, bounds, Color.blue, true);
   
    // There is a delay to avoid any race conditions   
    // and so user can see frame
    r.waitForIdle();
    r.delay(1000);
  }
View Full Code Here

   *
   * This tests a dynamically changing group.
   */
  public void test(TestHarness harness)
  {
    Robot r = harness.createRobot ();
    Frame frame = new Frame();
    Checkbox checkbox = new Checkbox("Checkbox");
    frame.add(checkbox);
    frame.setBounds(0, 0, 100, 100);
   
    harness.check(checkbox.getCheckboxGroup(), null);
    CheckboxGroup group = new CheckboxGroup();
    checkbox.setCheckboxGroup(group);
    harness.check(group, checkbox.getCheckboxGroup());
    frame.setVisible(true);
   
    r.waitForIdle ();
    r.delay(1000);
   
    checkbox.setCheckboxGroup(null);
   
    r.delay(1000);
   
    harness.check(checkbox.getCheckboxGroup(), null);
  }
View Full Code Here

    Rectangle bounds = c.getBounds();
    Insets i = f.getInsets();
    bounds.x += loc.x + i.left;
    bounds.y += loc.y + i.top;
   
    Robot r = harness.createRobot();
    Color label = r.getPixelColor(bounds.x + bounds.width/2 ,bounds.y + bounds.height/2 + 5);
    harness.check(label.equals(Color.blue));
   
    // There is a delay to avoid any race conditions   
    // and so user can see frame
    r.waitForIdle();
    r.delay(1000);
  }
View Full Code Here

    bounds.x += i.left;
    bounds.y += i.top;
    bounds.width -= (i.left + i.right);
    bounds.height -= (i.top + i.bottom);
   
    Robot r = harness.createRobot();
    Color scroll = r.getPixelColor(loc.x + bounds.width, loc.y + bounds.height/2);

    // Check if scrollbar was painted.
    harness.check(!(scroll.equals(Color.red)));
   
    // There is a delay to avoid any race conditions   
    // and so user can see frame
    r.waitForIdle();
    r.delay(1000);
  }
View Full Code Here

    loc.x += i.left + bounds.x;
    loc.y += i.top + bounds.y;
    bounds.width -= (i.left + i.right);
    bounds.height -= (i.top + i.bottom);
   
    Robot r = harness.createRobot();
    Color scroll = r.getPixelColor(loc.x + bounds.width, loc.y + bounds.height/2);
    harness.check(!(scroll.equals(Color.red)));
   
    // There is a delay to avoid any race conditions   
    // and so user can see frame
    r.waitForIdle();
    r.delay(2000);
  }
View Full Code Here

    testOldMouseEvents();
  }
 
  public void testOldMouseEvents()
  {
    Robot r = harness.createRobot();
       
    r.waitForIdle ();
   
    Point aLocScreen = a.getLocationOnScreen();
    Point aMiddle = new Point(aLocScreen.x + a.getWidth()/2, aLocScreen.y + a.getHeight()/2) ;
   
    r.mouseMove(aMiddle.x, aMiddle.y);
    r.delay (1000);
    harness.check(!mouseEnter);
    mouseEnter = false;
   
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.delay (1000);
    harness.check(!mouseDown);
    mouseDown = false;
   
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    r.delay (1000);
    harness.check(!mouseUp);
    mouseUp = false;
   
    Point bLocScreen = b.getLocationOnScreen();
    Point bMiddle = new Point(bLocScreen.x + b.getWidth()/2, bLocScreen.y + b.getHeight()/2) ;
   
    r.mouseMove(bMiddle.x, bMiddle.y);
    r.delay (1000);
    harness.check(!mouseExit);
    harness.check(!mouseEnter);
    mouseEnter = false;
    mouseExit = false;
   
    r.mousePress(InputEvent.BUTTON1_MASK);
    r.delay (1000);
    harness.check(!mouseDown);
    mouseDown = false;
   
    r.mouseRelease(InputEvent.BUTTON1_MASK);
    r.delay (1000);
    harness.check(!mouseUp);
    mouseUp = false;

    r.mouseMove(bMiddle.x*2, bMiddle.y*2);
    r.delay (1000);
    harness.check(!mouseExit);
    mouseExit = false;
  }
View Full Code Here

    Insets i = f.getInsets();
    Point loc = f.getLocationOnScreen();
    bounds.x += i.left + loc.x;
    bounds.y += i.top + loc.y;
   
    Robot r = harness.createRobot();
    Color choice = r.getPixelColor(bounds.x, bounds.y + bounds.height/2);
    harness.check(choice.equals(Color.BLUE));
   
    // There is a delay to avoid any race conditions   
    // and so user can see frame
    r.waitForIdle();
    r.delay(1000);
  }
View Full Code Here

    Point loc = f.getLocationOnScreen();
    Insets i = f.getInsets();
    bounds.x += i.left + loc.x;
    bounds.y += i.top + loc.y;
   
    Robot r = harness.createRobot();
    Color but = r.getPixelColor(bounds.x + bounds.width/2, bounds.y + bounds.height/2);
    harness.check(!but.equals(Color.red));
   
    // There is a delay to avoid any race conditions   
    // and so user can see frame
    r.waitForIdle();
    r.delay(1000);
  }
View Full Code Here

TOP

Related Classes of java.awt.Robot

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.