< prev index next >

test/jdk/java/awt/ComponentOrientation/BorderTest.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 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 /*
  25  * @test
  26  * @key headful
  27  * @bug     4108453
  28  * @summary Test ComponentOrientation (Bidi) support in BorderLayout
  29  */
  30 /*
  31  * (C) Copyright IBM Corp. 1998 - All Rights Reserved
  32  *
  33  * The original version of this source code and documentation is copyrighted
  34  * and owned by IBM, Inc. These materials are provided under terms of a
  35  * License Agreement between IBM and Sun. This technology is protected by
  36  * multiple US and International patents. This notice and attribution to IBM
  37  * may not be removed.
  38  */
  39 
  40 import java.awt.*;
  41 import java.awt.event.*;
  42 import java.applet.Applet;
  43 
  44 public class BorderTest extends Applet {
  45     Panel       panel1;
  46     Panel       panel2;
  47 
  48     public BorderTest() {
  49         setLayout(new GridLayout(0,2));
  50 
  51         // Create a panel with a BorderLayout and a bunch of buttons in it
  52         panel1 = new Panel();
  53         panel1.setLayout(new BorderLayout());
  54         panel1.add("North", new Button("North"));
  55         panel1.add("South", new Button("South"));
  56         panel1.add("East", new Button("East"));
  57         panel1.add("West", new Button("West"));
  58         panel1.add("Center", new Button("Center"));
  59         add(panel1);
  60 
  61         // Create a panel with a BorderLayout and a bunch of buttons in it
  62         panel2 = new Panel();
  63         panel2.setLayout(new BorderLayout());
  64         panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));


  91                     panel1.repaint();
  92                     panel2.repaint();
  93                 }
  94             } );
  95             add(c);
  96         }
  97     }
  98 
  99     public static void main(String args[]) {
 100         Frame f = new Frame("BorderTest");
 101 
 102         f.addWindowListener( new WindowAdapter() {
 103             public void windowClosing(WindowEvent e) {
 104                 e.getWindow().hide();
 105                 e.getWindow().dispose();
 106                 System.exit(0);
 107             };
 108         } );
 109 
 110         BorderTest BorderTest = new BorderTest();
 111         BorderTest.init();
 112         BorderTest.start();
 113 
 114         f.add("Center", BorderTest);
 115         f.setSize(450, 300);
 116         f.show();
 117     }
 118 }
   1 /*
   2  * Copyright (c) 1998, 2018, 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 /*
  25  * @test
  26  * @key headful
  27  * @bug     4108453
  28  * @summary Test ComponentOrientation (Bidi) support in BorderLayout
  29  */
  30 /*
  31  * (C) Copyright IBM Corp. 1998 - All Rights Reserved
  32  *
  33  * The original version of this source code and documentation is copyrighted
  34  * and owned by IBM, Inc. These materials are provided under terms of a
  35  * License Agreement between IBM and Sun. This technology is protected by
  36  * multiple US and International patents. This notice and attribution to IBM
  37  * may not be removed.
  38  */
  39 
  40 import java.awt.*;
  41 import java.awt.event.*;

  42 
  43 public class BorderTest extends Panel {
  44     Panel       panel1;
  45     Panel       panel2;
  46 
  47     public BorderTest() {
  48         setLayout(new GridLayout(0,2));
  49 
  50         // Create a panel with a BorderLayout and a bunch of buttons in it
  51         panel1 = new Panel();
  52         panel1.setLayout(new BorderLayout());
  53         panel1.add("North", new Button("North"));
  54         panel1.add("South", new Button("South"));
  55         panel1.add("East", new Button("East"));
  56         panel1.add("West", new Button("West"));
  57         panel1.add("Center", new Button("Center"));
  58         add(panel1);
  59 
  60         // Create a panel with a BorderLayout and a bunch of buttons in it
  61         panel2 = new Panel();
  62         panel2.setLayout(new BorderLayout());
  63         panel2.add(BorderLayout.BEFORE_FIRST_LINE, new Button("FirstLine"));


  90                     panel1.repaint();
  91                     panel2.repaint();
  92                 }
  93             } );
  94             add(c);
  95         }
  96     }
  97 
  98     public static void main(String args[]) {
  99         Frame f = new Frame("BorderTest");
 100 
 101         f.addWindowListener( new WindowAdapter() {
 102             public void windowClosing(WindowEvent e) {
 103                 e.getWindow().hide();
 104                 e.getWindow().dispose();
 105                 System.exit(0);
 106             };
 107         } );
 108 
 109         BorderTest BorderTest = new BorderTest();


 110 
 111         f.add("Center", BorderTest);
 112         f.setSize(450, 300);
 113         f.show();
 114     }
 115 }
< prev index next >