< prev index next >

src/java.desktop/share/classes/java/awt/FlowLayout.java

Print this page
rev 55470 : 8225372: accessibility errors in tables in java.desktop files
Reviewed-by: aivanov
   1 /*
   2  * Copyright (c) 1995, 2013, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  37  * <li>{@code ComponentOrientation.RIGHT_TO_LEFT}
  38  * </ul>
  39  * Flow layouts are typically used
  40  * to arrange buttons in a panel. It arranges buttons
  41  * horizontally until no more buttons fit on the same line.
  42  * The line alignment is determined by the {@code align}
  43  * property. The possible values are:
  44  * <ul>
  45  * <li>{@link #LEFT LEFT}
  46  * <li>{@link #RIGHT RIGHT}
  47  * <li>{@link #CENTER CENTER}
  48  * <li>{@link #LEADING LEADING}
  49  * <li>{@link #TRAILING TRAILING}
  50  * </ul>
  51  * <p>
  52  * For example, the following picture shows an applet using the flow
  53  * layout manager (its default layout manager) to position three buttons:
  54  * <p>
  55  * <img src="doc-files/FlowLayout-1.gif"
  56  * ALT="Graphic of Layout for Three Buttons"
  57  * style="float:center; margin: 7px 10px;">
  58  * <p>
  59  * Here is the code for this applet:
  60  *
  61  * <hr><blockquote><pre>
  62  * import java.awt.*;
  63  * import java.applet.Applet;
  64  *
  65  * public class myButtons extends Applet {
  66  *     Button button1, button2, button3;
  67  *     public void init() {
  68  *         button1 = new Button("Ok");
  69  *         button2 = new Button("Open");
  70  *         button3 = new Button("Close");
  71  *         add(button1);
  72  *         add(button2);
  73  *         add(button3);
  74  *     }
  75  * }
  76  * </pre></blockquote><hr>
  77  * <p>


   1 /*
   2  * Copyright (c) 1995, 2019, 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.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  37  * <li>{@code ComponentOrientation.RIGHT_TO_LEFT}
  38  * </ul>
  39  * Flow layouts are typically used
  40  * to arrange buttons in a panel. It arranges buttons
  41  * horizontally until no more buttons fit on the same line.
  42  * The line alignment is determined by the {@code align}
  43  * property. The possible values are:
  44  * <ul>
  45  * <li>{@link #LEFT LEFT}
  46  * <li>{@link #RIGHT RIGHT}
  47  * <li>{@link #CENTER CENTER}
  48  * <li>{@link #LEADING LEADING}
  49  * <li>{@link #TRAILING TRAILING}
  50  * </ul>
  51  * <p>
  52  * For example, the following picture shows an applet using the flow
  53  * layout manager (its default layout manager) to position three buttons:
  54  * <p>
  55  * <img src="doc-files/FlowLayout-1.gif"
  56  * ALT="Graphic of Layout for Three Buttons"
  57  * style="margin: 7px 10px;">
  58  * <p>
  59  * Here is the code for this applet:
  60  *
  61  * <hr><blockquote><pre>
  62  * import java.awt.*;
  63  * import java.applet.Applet;
  64  *
  65  * public class myButtons extends Applet {
  66  *     Button button1, button2, button3;
  67  *     public void init() {
  68  *         button1 = new Button("Ok");
  69  *         button2 = new Button("Open");
  70  *         button3 = new Button("Close");
  71  *         add(button1);
  72  *         add(button2);
  73  *         add(button3);
  74  *     }
  75  * }
  76  * </pre></blockquote><hr>
  77  * <p>


< prev index next >