test/jdk/java/awt/List/FocusEmptyListTest/FocusEmptyListTest.java
changeset 54231 e4813eded7cb
parent 47216 71c04702a3d5
equal deleted inserted replaced
54230:d9d9655bb077 54231:e4813eded7cb
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2018, 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.
    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 /*
    24 /*
    25   test
    25   @test
       
    26   @key headful
    26   @bug 6387275
    27   @bug 6387275
    27   @summary List: the focus is at the top of the first item, XAWT
    28   @summary List: the focus is at the top of the first item, XAWT
    28   @author Dmitry.Cherepanov@SUN.COM area=awt.list
    29   @requires (os.family == "linux" | os.family == "solaris")
    29   @run applet FocusEmptyListTest.html
    30   @modules java.desktop/sun.awt
       
    31            java.desktop/java.awt.peer
       
    32            java.desktop/sun.awt.X11:open
       
    33   @run main FocusEmptyListTest
    30 */
    34 */
    31 
    35 
    32 import java.applet.Applet;
       
    33 import java.awt.*;
    36 import java.awt.*;
    34 import java.lang.reflect.*;
    37 import java.lang.reflect.*;
    35 import java.awt.peer.ListPeer;
    38 import java.awt.peer.ListPeer;
    36 
    39 
    37 import sun.awt.AWTAccessor;
    40 import sun.awt.AWTAccessor;
    38 
    41 
    39 public class FocusEmptyListTest extends Applet {
    42 public class FocusEmptyListTest extends Frame {
    40 
    43 
    41     public void init() {
    44     public static void main(final String[] args) {
    42         setLayout(new BorderLayout());
    45         FocusEmptyListTest app = new FocusEmptyListTest();
    43     }//End  init()
    46         app.start();
       
    47     }
    44 
    48 
    45     public void start() {
    49     public void start() {
    46         boolean isXToolkit = Toolkit.getDefaultToolkit()
    50         boolean isXToolkit = Toolkit.getDefaultToolkit()
    47             .getClass().getName().equals("sun.awt.X11.XToolkit");
    51             .getClass().getName().equals("sun.awt.X11.XToolkit");
    48         if (!isXToolkit) {
    52         if (!isXToolkit) {
    59 
    63 
    60         add(list);
    64         add(list);
    61         list.add("item1");
    65         list.add("item1");
    62 
    66 
    63         setSize(200, 200);
    67         setSize(200, 200);
       
    68         setUndecorated(true);
       
    69         setLocationRelativeTo(null);
    64         setVisible(true);
    70         setVisible(true);
    65         validate();
    71         validate();
    66 
    72 
    67         list.removeAll();
    73         list.removeAll();
    68 
    74