< prev index next >

test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java

Print this page
rev 14031 : 8159690: [TESTBUG] Mark headful tests with @key headful.

Backport of 14851:980da45565c8 from jdk9.  542/842 hunks applied directly from
the patch. 44 I resolved manually.  The remaining hunks are for filenames that
do not exist in jdk8u.
   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.FlowLayout;
  25 import java.awt.Frame;
  26 import java.awt.Panel;
  27 import java.awt.Point;
  28 import java.awt.Robot;
  29 import java.awt.TextField;
  30 import java.awt.Toolkit;
  31 import java.awt.event.InputEvent;
  32 import sun.awt.SunToolkit;
  33 
  34 /**
  35  * @test

  36  * @bug 8036110
  37  * @author Alexander Scherbatiy
  38  * @summary In TextField can only select text visible or to the left
  39  * @run main SelectionInvisibleTest
  40  */
  41 
  42 public class SelectionInvisibleTest {
  43 
  44     private static final String TEXT = "One Two Three Four Five Six Seven Eight Nine ";
  45     private static final String LAST_WORD = "Ten";
  46 
  47     public static void main(String[] args) throws Exception {
  48 
  49         Frame frame = new Frame();
  50         frame.setSize(300, 200);
  51         TextField textField = new TextField(TEXT + LAST_WORD, 30);
  52         Panel panel = new Panel(new FlowLayout());
  53         panel.add(textField);
  54         frame.add(panel);
  55         frame.setVisible(true);


   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.FlowLayout;
  25 import java.awt.Frame;
  26 import java.awt.Panel;
  27 import java.awt.Point;
  28 import java.awt.Robot;
  29 import java.awt.TextField;
  30 import java.awt.Toolkit;
  31 import java.awt.event.InputEvent;
  32 import sun.awt.SunToolkit;
  33 
  34 /**
  35  * @test
  36  * @key headful
  37  * @bug 8036110
  38  * @author Alexander Scherbatiy
  39  * @summary In TextField can only select text visible or to the left
  40  * @run main SelectionInvisibleTest
  41  */
  42 
  43 public class SelectionInvisibleTest {
  44 
  45     private static final String TEXT = "One Two Three Four Five Six Seven Eight Nine ";
  46     private static final String LAST_WORD = "Ten";
  47 
  48     public static void main(String[] args) throws Exception {
  49 
  50         Frame frame = new Frame();
  51         frame.setSize(300, 200);
  52         TextField textField = new TextField(TEXT + LAST_WORD, 30);
  53         Panel panel = new Panel(new FlowLayout());
  54         panel.add(textField);
  55         frame.add(panel);
  56         frame.setVisible(true);


< prev index next >