< prev index next >

test/jdk/java/awt/Choice/PopupPosTest/PopupPosTest.java

Print this page




   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 /*
  25   test

  26   @bug 5044150
  27   @summary Tests that pupup doesn't popdown if no space to display under
  28   @author andrei.dmitriev area=awt.choice
  29   @library /test/lib
  30   @build jdk.test.lib.Platform
  31   @run applet PopupPosTest.html
  32 */
  33 
  34 import java.applet.Applet;
  35 import java.awt.*;
  36 import java.awt.event.*;
  37 
  38 import jdk.test.lib.Platform;
  39 
  40 public class PopupPosTest extends Applet
  41 {
  42     public void start ()
  43     {
  44         if (Platform.isOSX()) {
  45             // On OS X, popup isn't under the mouse
  46             return;
  47         }
  48         Frame frame = new TestFrame();
  49     }
  50 }
  51 
  52 class TestFrame extends Frame implements ItemListener {
  53     Robot robot;
  54     Toolkit tk = Toolkit.getDefaultToolkit();
  55     Choice choice = new Choice();
  56     boolean indexChanged = false;
  57     final static int INITIAL_ITEM = 99;
  58     volatile boolean stateChanged;
  59 
  60     public TestFrame() {
  61         for (int i = 0; i < 100; i++) {
  62              choice.addItem("Item Item Item " + i);
  63         }




   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 /*
  25   @test
  26   @key headful
  27   @bug 5044150
  28   @summary Tests that pupup doesn't popdown if no space to display under

  29   @library /test/lib
  30   @build jdk.test.lib.Platform
  31   @run main PopupPosTest
  32 */
  33 

  34 import java.awt.*;
  35 import java.awt.event.*;
  36 
  37 import jdk.test.lib.Platform;
  38 
  39 public class PopupPosTest {
  40 
  41     public static void main(final String[] args) {

  42         if (Platform.isOSX()) {
  43             // On OS X, popup isn't under the mouse
  44             return;
  45         }
  46         Frame frame = new TestFrame();
  47     }
  48 }
  49 
  50 class TestFrame extends Frame implements ItemListener {
  51     Robot robot;
  52     Toolkit tk = Toolkit.getDefaultToolkit();
  53     Choice choice = new Choice();
  54     boolean indexChanged = false;
  55     final static int INITIAL_ITEM = 99;
  56     volatile boolean stateChanged;
  57 
  58     public TestFrame() {
  59         for (int i = 0; i < 100; i++) {
  60              choice.addItem("Item Item Item " + i);
  61         }


< prev index next >