test/jdk/java/awt/Window/LocationAtScreenCorner/LocationAtScreenCorner.java
changeset 59189 b5cdba232fca
parent 50343 80a5ff734fcd
equal deleted inserted replaced
59188:9db62a092725 59189:b5cdba232fca
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 import java.awt.AWTException;
    24 import java.awt.Frame;
    25 import java.awt.Frame;
    25 import java.awt.GraphicsDevice;
    26 import java.awt.GraphicsDevice;
    26 import java.awt.GraphicsEnvironment;
    27 import java.awt.GraphicsEnvironment;
    27 import java.awt.Point;
    28 import java.awt.Point;
    28 import java.awt.Rectangle;
    29 import java.awt.Rectangle;
    29 import java.awt.Robot;
    30 import java.awt.Robot;
    30 
    31 
    31 /**
    32 /**
    32  * @test
    33  * @test
    33  * @key headful
    34  * @key headful
    34  * @bug 8201364
    35  * @bug 8201364 8232433
    35  * @summary Component.getLocation() should returns correct location if
    36  * @summary Component.getLocation() should returns correct location if
    36  *          Component.setBounds() was ignored by the OS
    37  *          Component.setBounds() was ignored by the OS
    37  */
    38  */
    38 public final class LocationAtScreenCorner {
    39 public final class LocationAtScreenCorner {
    39 
    40 
    40     public static void main(final String[] args) throws Exception {
    41     public static void main(final String[] args) throws Exception {
       
    42         test(true);
       
    43         test(false);
       
    44     }
       
    45 
       
    46     private static void test(final boolean undecorated) throws AWTException {
    41         Robot robot = new Robot();
    47         Robot robot = new Robot();
    42         Frame frame = new Frame();
    48         Frame frame = new Frame();
       
    49         frame.setUndecorated(undecorated);
    43         frame.setSize(200, 200);
    50         frame.setSize(200, 200);
    44         frame.setLocationRelativeTo(null);
    51         frame.setLocationRelativeTo(null);
    45         frame.setVisible(true);
    52         frame.setVisible(true);
    46         robot.waitForIdle();
    53         robot.waitForIdle();
    47 
    54