Robot Example

    public void testMinimizeButton() throws AWTException {
       
        frame.setVisible(true);
        
        Point p = frame.getLocationOnScreen();
        Robot r = new Robot();
        r.setAutoWaitForIdle(true);
        r.mouseMove(p.x+35, p.y+10);
        r.mousePress(InputEvent.BUTTON1_MASK);
        r.mouseRelease(InputEvent.BUTTON1_MASK);
        r.delay(1000); // needs a couple of seconds for the state to update
        int state = frame.getExtendedState();
        assertEquals(Frame.ICONIFIED, state);
        
    }

Previous | Next | Top | Cafe con Leche

Copyright 2005, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified September 28, 2005