< prev index next >

test/jdk/java/awt/ComponentOrientation/FlowTest.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 FlowLayout
  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 FlowTest extends Applet {
  45     Panel       panel;
  46 
  47     public FlowTest() {
  48         setLayout(new BorderLayout());
  49 
  50         // Create a panel with a FlowLayout and a bunch of buttons in it
  51         panel = new Panel();
  52         panel.setLayout(new FlowLayout(FlowLayout.LEFT));
  53         panel.add(new Button("one"));
  54         panel.add(new Button("two"));
  55         panel.add(new Button("three"));
  56         panel.add(new Button("four"));
  57         panel.add(new Button("five"));
  58         panel.add(new Button("six"));
  59         panel.add(new Button("seven"));
  60         panel.add(new Button("eight"));
  61         panel.add(new Button("nine"));
  62         panel.add(new Button("ten"));
  63         panel.add(new Button("eleven"));
  64 


 124             controls.add(new Label("ComponentOrientation:"));
 125             controls.add(c);
 126         }
 127 
 128         add("South", controls);
 129 
 130     }
 131 
 132     public static void main(String args[]) {
 133         Frame f = new Frame("FlowTest");
 134 
 135         f.addWindowListener( new WindowAdapter() {
 136             public void windowClosing(WindowEvent e) {
 137                 e.getWindow().hide();
 138                 e.getWindow().dispose();
 139                 System.exit(0);
 140             };
 141         } );
 142 
 143         FlowTest flowTest = new FlowTest();
 144         flowTest.init();
 145         flowTest.start();
 146 
 147         f.add("Center", flowTest);
 148         f.setSize(300, 300);
 149         f.show();
 150     }
 151 }
   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 FlowLayout
  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 FlowTest extends Panel {
  44     Panel       panel;
  45 
  46     public FlowTest() {
  47         setLayout(new BorderLayout());
  48 
  49         // Create a panel with a FlowLayout and a bunch of buttons in it
  50         panel = new Panel();
  51         panel.setLayout(new FlowLayout(FlowLayout.LEFT));
  52         panel.add(new Button("one"));
  53         panel.add(new Button("two"));
  54         panel.add(new Button("three"));
  55         panel.add(new Button("four"));
  56         panel.add(new Button("five"));
  57         panel.add(new Button("six"));
  58         panel.add(new Button("seven"));
  59         panel.add(new Button("eight"));
  60         panel.add(new Button("nine"));
  61         panel.add(new Button("ten"));
  62         panel.add(new Button("eleven"));
  63 


 123             controls.add(new Label("ComponentOrientation:"));
 124             controls.add(c);
 125         }
 126 
 127         add("South", controls);
 128 
 129     }
 130 
 131     public static void main(String args[]) {
 132         Frame f = new Frame("FlowTest");
 133 
 134         f.addWindowListener( new WindowAdapter() {
 135             public void windowClosing(WindowEvent e) {
 136                 e.getWindow().hide();
 137                 e.getWindow().dispose();
 138                 System.exit(0);
 139             };
 140         } );
 141 
 142         FlowTest flowTest = new FlowTest();


 143 
 144         f.add("Center", flowTest);
 145         f.setSize(300, 300);
 146         f.show();
 147     }
 148 }
< prev index next >