1398N/A/*
2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1398N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1398N/A *
1398N/A * This code is free software; you can redistribute it and/or modify it
1398N/A * under the terms of the GNU General Public License version 2 only, as
1398N/A * published by the Free Software Foundation.
1398N/A *
1398N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1398N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1398N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1398N/A * version 2 for more details (a copy is included in the LICENSE file that
1398N/A * accompanied this code).
1398N/A *
1398N/A * You should have received a copy of the GNU General Public License version
1398N/A * 2 along with this work; if not, write to the Free Software Foundation,
1398N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1398N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1398N/A */
1398N/A
1398N/A/*
1398N/A @test
1398N/A @bug 6855323
1398N/A @summary Robot(GraphicsDevice) constructor initializes LEGAL_BUTTON_MASK variable improperly
1398N/A @author Dmitry Cherepanov area=awt.robot
1398N/A @run main CtorTest
1398N/A*/
1398N/A
1398N/A/**
1398N/A * CtorRobot.java
1398N/A *
1398N/A * summary: creates Robot using one parameter constructor
1398N/A */
1398N/A
1398N/Aimport java.awt.*;
1398N/Aimport java.awt.event.*;
1398N/A
1398N/Aimport sun.awt.SunToolkit;
1398N/A
1398N/Apublic class CtorTest
1398N/A{
1398N/A public static void main(String []s) throws Exception
1398N/A {
1398N/A // one parameter constructor
1398N/A GraphicsDevice graphicsDevice = GraphicsEnvironment.
1398N/A getLocalGraphicsEnvironment().getDefaultScreenDevice();
1398N/A Robot robot = new Robot(graphicsDevice);
1398N/A clickOnFrame(robot);
1398N/A }
1398N/A
1398N/A // generate mouse events
1398N/A private static void clickOnFrame(Robot robot) {
1398N/A Frame frame = new Frame();
1398N/A frame.setBounds(100, 100, 100, 100);
1398N/A frame.setVisible(true);
1398N/A
1398N/A ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1398N/A
1398N/A // click in the middle of the frame
1398N/A robot.mouseMove(150, 150);
1398N/A robot.delay(50);
1398N/A robot.mousePress(InputEvent.BUTTON1_MASK);
1398N/A robot.delay(50);
1398N/A robot.mouseRelease(InputEvent.BUTTON1_MASK);
1398N/A
1398N/A ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
1398N/A }
1398N/A}