< prev index next >

test/jdk/java/awt/List/FirstItemRemoveTest/FirstItemRemoveTest.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 6299858 7124338

  27   @summary PIT. Focused border not shown on List if selected item is removed, XToolkit
  28   @author Dmitry.Cherepanov@SUN.COM area=awt.list
  29   @run applet FirstItemRemoveTest.html

  30 */
  31 
  32 import jdk.test.lib.Platform;
  33 
  34 import java.applet.Applet;
  35 import java.awt.*;
  36 import java.awt.event.*;
  37 
  38 public class FirstItemRemoveTest extends Applet
  39 {
  40     List list = new List(4, false);
  41     Panel panel = new Panel();
  42 






  43     public void init()
  44     {
  45         list.add("000");
  46         list.add("111");
  47         list.add("222");
  48         list.add("333");
  49         list.add("444");
  50         list.add("555");
  51 
  52         panel.setLayout(new FlowLayout ());
  53         panel.add(list);
  54 
  55         this.add(panel);
  56         this.setLayout (new FlowLayout ());
  57     }//End  init()
  58 
  59     public void start ()
  60     {
  61         setSize (200,200);


  62         setVisible(true);
  63         validate();
  64 
  65         test();
  66     }// start()
  67 
  68     private void test(){
  69 
  70         if (Platform.isOSX()) {
  71             System.err.println("Skipped. This test is not for OS X.");
  72             return;
  73         }
  74 
  75         Robot r;
  76         try {
  77             r = new Robot();
  78         } catch(AWTException e) {
  79             throw new RuntimeException(e.getMessage());
  80         }
  81 




   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 6299858
  28   @summary PIT. Focused border not shown on List if selected item is removed, XToolkit
  29   @library /test/lib
  30   @build jdk.test.lib.Platform
  31   @run main FirstItemRemoveTest
  32 */
  33 
  34 import jdk.test.lib.Platform;
  35 

  36 import java.awt.*;
  37 import java.awt.event.*;
  38 
  39 public class FirstItemRemoveTest extends Frame
  40 {
  41     List list = new List(4, false);
  42     Panel panel = new Panel();
  43 
  44     public static void main(final String[] args) {
  45         FirstItemRemoveTest app = new FirstItemRemoveTest();
  46         app.init();
  47         app.start();
  48     }
  49 
  50     public void init()
  51     {
  52         list.add("000");
  53         list.add("111");
  54         list.add("222");
  55         list.add("333");
  56         list.add("444");
  57         list.add("555");
  58 
  59         panel.setLayout(new FlowLayout ());
  60         panel.add(list);
  61 
  62         this.add(panel);
  63         this.setLayout (new FlowLayout ());
  64     }//End  init()
  65 
  66     public void start ()
  67     {
  68         setSize (200,200);
  69         setUndecorated(true);
  70         setLocationRelativeTo(null);
  71         setVisible(true);
  72         validate();
  73 
  74         test();
  75     }// start()
  76 
  77     private void test(){
  78 
  79         if (Platform.isOSX()) {
  80             System.err.println("Skipped. This test is not for OS X.");
  81             return;
  82         }
  83 
  84         Robot r;
  85         try {
  86             r = new Robot();
  87         } catch(AWTException e) {
  88             throw new RuntimeException(e.getMessage());
  89         }
  90 


< prev index next >