< prev index next >

test/java/awt/Window/setLocRelativeTo/SetLocationRelativeToTest.java

Print this page
rev 14836 : 8159690: [TESTBUG] Mark headful tests with @key headful.
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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
  21  * questions.
  22  */
  23 
  24 import java.awt.*;
  25 import java.util.ArrayList;
  26 import javax.swing.*;
  27 
  28 /*
  29 @test
  30 @summary Toplevel should be correctly positioned as relative to a component:
  31        so that their centers coincide
  32        or, if the component is hidden, centered on the screen.
  33 @bug 8036915
  34 @library ../../../../lib/testlibrary
  35 @build ExtendedRobot
  36 @run main/timeout=1200 SetLocationRelativeToTest
  37 */

  38 
  39 public class SetLocationRelativeToTest {
  40     private static int delay = 500;
  41     private static boolean testEverything = false;// NB: change this to true to test everything
  42     java.util.List<Window> awtToplevels = new ArrayList<Window>();
  43     java.util.List<Window> swingToplevels = new ArrayList<Window>();
  44     java.util.List<Window> allToplevels = new ArrayList<Window>();
  45     java.util.List<Component> awtComponents = new ArrayList<Component>();
  46     java.util.List<Component> swingComponents = new ArrayList<Component>();
  47     java.util.List<Component> allComponents = new ArrayList<Component>();
  48     Label placeholder = new Label();
  49     JLabel jplaceholder = new JLabel();
  50     JFrame jcontainer;
  51     public SetLocationRelativeToTest() {
  52         Frame frame = new Frame("Frame");
  53         frame.setSize(200,100);
  54         Frame uframe = new Frame("U.Frame");
  55         uframe.setUndecorated(true);
  56         uframe.setSize(200,100);
  57         Window window = new Window(frame);


   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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
  21  * questions.
  22  */
  23 
  24 import java.awt.*;
  25 import java.util.ArrayList;
  26 import javax.swing.*;
  27 
  28 /*
  29  * @test
  30  * @key headful
  31  * @summary Toplevel should be correctly positioned as relative to a component:
  32  *          so that their centers coincide
  33  *          or, if the component is hidden, centered on the screen.
  34  * @bug 8036915
  35  * @library ../../../../lib/testlibrary
  36  * @build ExtendedRobot
  37  * @run main/timeout=1200 SetLocationRelativeToTest
  38  */
  39 
  40 public class SetLocationRelativeToTest {
  41     private static int delay = 500;
  42     private static boolean testEverything = false;// NB: change this to true to test everything
  43     java.util.List<Window> awtToplevels = new ArrayList<Window>();
  44     java.util.List<Window> swingToplevels = new ArrayList<Window>();
  45     java.util.List<Window> allToplevels = new ArrayList<Window>();
  46     java.util.List<Component> awtComponents = new ArrayList<Component>();
  47     java.util.List<Component> swingComponents = new ArrayList<Component>();
  48     java.util.List<Component> allComponents = new ArrayList<Component>();
  49     Label placeholder = new Label();
  50     JLabel jplaceholder = new JLabel();
  51     JFrame jcontainer;
  52     public SetLocationRelativeToTest() {
  53         Frame frame = new Frame("Frame");
  54         frame.setSize(200,100);
  55         Frame uframe = new Frame("U.Frame");
  56         uframe.setUndecorated(true);
  57         uframe.setSize(200,100);
  58         Window window = new Window(frame);


< prev index next >