2362N/A * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A flow layout arranges components in a directional flow, much 0N/A * like lines of text in a paragraph. The flow direction is 0N/A * determined by the container's <code>componentOrientation</code> 0N/A * property and may be one of two values: 0N/A * <li><code>ComponentOrientation.LEFT_TO_RIGHT</code> 0N/A * <li><code>ComponentOrientation.RIGHT_TO_LEFT</code> 0N/A * Flow layouts are typically used 0N/A * to arrange buttons in a panel. It arranges buttons 0N/A * horizontally until no more buttons fit on the same line. 0N/A * The line alignment is determined by the <code>align</code> 0N/A * property. The possible values are: 0N/A * <li>{@link #LEFT LEFT} 0N/A * <li>{@link #RIGHT RIGHT} 0N/A * <li>{@link #CENTER CENTER} 0N/A * <li>{@link #LEADING LEADING} 0N/A * <li>{@link #TRAILING TRAILING} 0N/A * For example, the following picture shows an applet using the flow 0N/A * layout manager (its default layout manager) to position three buttons: 0N/A * ALT="Graphic of Layout for Three Buttons" 0N/A * ALIGN=center HSPACE=10 VSPACE=7> 0N/A * Here is the code for this applet: 0N/A * <hr><blockquote><pre> 0N/A * import java.awt.*; 0N/A * import java.applet.Applet; 0N/A * public class myButtons extends Applet { 0N/A * Button button1, button2, button3; 0N/A * public void init() { 0N/A * button1 = new Button("Ok"); 0N/A * button2 = new Button("Open"); 0N/A * button3 = new Button("Close"); 0N/A * </pre></blockquote><hr> 0N/A * A flow layout lets each component assume its natural (preferred) size. 0N/A * @author Arthur van Hoff 0N/A * @author Sami Shaio 0N/A * @see ComponentOrientation 0N/A * This value indicates that each row of components 0N/A * should be left-justified. 0N/A * This value indicates that each row of components 0N/A * should be centered. 0N/A * This value indicates that each row of components 0N/A * should be right-justified. 0N/A * This value indicates that each row of components 0N/A * should be justified to the leading edge of the container's 0N/A * orientation, for example, to the left in left-to-right orientations. 0N/A * @see java.awt.Component#getComponentOrientation 0N/A * @see java.awt.ComponentOrientation 0N/A * This value indicates that each row of components 0N/A * should be justified to the trailing edge of the container's 0N/A * orientation, for example, to the right in left-to-right orientations. 0N/A * @see java.awt.Component#getComponentOrientation 0N/A * @see java.awt.ComponentOrientation 0N/A * <code>align</code> is the property that determines 0N/A * how each row distributes empty space. 0N/A * It can be one of the following values: 0N/A * <code>RIGHT</code> 0N/A * <code>CENTER</code> 0N/A * @see #getAlignment 0N/A * @see #setAlignment 0N/A int align;
// This is for 1.1 serialization compatibility 0N/A * <code>newAlign</code> is the property that determines 0N/A * how each row distributes empty space for the Java 2 platform, 0N/A * It can be one of the following three values: 0N/A * <code>RIGHT</code> 0N/A * <code>CENTER</code> 0N/A * <code>LEADING</code> 0N/A * <code>TRAILING</code> 0N/A * @see #getAlignment 0N/A * @see #setAlignment 0N/A * The flow layout manager allows a seperation of 0N/A * components with gaps. The horizontal gap will 0N/A * specify the space between components and between 0N/A * the components and the borders of the 0N/A * <code>Container</code>. 0N/A * @see #setHgap(int) 0N/A * The flow layout manager allows a seperation of 0N/A * components with gaps. The vertical gap will 0N/A * specify the space between rows and between the 0N/A * the rows and the borders of the <code>Container</code>. 0N/A * @see #setHgap(int) 0N/A * If true, components will be aligned on their baseline. 0N/A * JDK 1.1 serialVersionUID 0N/A * Constructs a new <code>FlowLayout</code> with a centered alignment and a 0N/A * default 5-unit horizontal and vertical gap. 0N/A * Constructs a new <code>FlowLayout</code> with the specified 0N/A * alignment and a default 5-unit horizontal and vertical gap. 0N/A * The value of the alignment argument must be one of 0N/A * <code>FlowLayout.LEFT</code>, <code>FlowLayout.RIGHT</code>, 0N/A * <code>FlowLayout.CENTER</code>, <code>FlowLayout.LEADING</code>, 0N/A * or <code>FlowLayout.TRAILING</code>. 0N/A * @param align the alignment value 0N/A * Creates a new flow layout manager with the indicated alignment 0N/A * and the indicated horizontal and vertical gaps. 0N/A * The value of the alignment argument must be one of 0N/A * <code>FlowLayout.LEFT</code>, <code>FlowLayout.RIGHT</code>, 0N/A * <code>FlowLayout.CENTER</code>, <code>FlowLayout.LEADING</code>, 0N/A * or <code>FlowLayout.TRAILING</code>. 0N/A * @param align the alignment value 0N/A * @param hgap the horizontal gap between components 0N/A * and between the components and the 0N/A * borders of the <code>Container</code> 0N/A * @param vgap the vertical gap between components 0N/A * and between the components and the 0N/A * borders of the <code>Container</code> 0N/A * Gets the alignment for this layout. 0N/A * Possible values are <code>FlowLayout.LEFT</code>, 0N/A * <code>FlowLayout.RIGHT</code>, <code>FlowLayout.CENTER</code>, 0N/A * <code>FlowLayout.LEADING</code>, 0N/A * or <code>FlowLayout.TRAILING</code>. 0N/A * @return the alignment value for this layout 0N/A * @see java.awt.FlowLayout#setAlignment 0N/A * Sets the alignment for this layout. 0N/A * Possible values are 0N/A * <li><code>FlowLayout.LEFT</code> 0N/A * <li><code>FlowLayout.RIGHT</code> 0N/A * <li><code>FlowLayout.CENTER</code> 0N/A * <li><code>FlowLayout.LEADING</code> 0N/A * <li><code>FlowLayout.TRAILING</code> 0N/A * @param align one of the alignment values shown above 0N/A * @see #getAlignment() 0N/A // this.align is used only for serialization compatibility, 0N/A // so set it to a value compatible with the 1.1 version 0N/A * Gets the horizontal gap between components 0N/A * and between the components and the borders 0N/A * of the <code>Container</code> 0N/A * @return the horizontal gap between components 0N/A * and between the components and the borders 0N/A * of the <code>Container</code> 0N/A * @see java.awt.FlowLayout#setHgap 0N/A * Sets the horizontal gap between components and 0N/A * between the components and the borders of the 0N/A * <code>Container</code>. 0N/A * @param hgap the horizontal gap between components 0N/A * and between the components and the borders 0N/A * of the <code>Container</code> 0N/A * @see java.awt.FlowLayout#getHgap 0N/A * Gets the vertical gap between components and 0N/A * between the components and the borders of the 0N/A * <code>Container</code>. 0N/A * @return the vertical gap between components 0N/A * and between the components and the borders 0N/A * of the <code>Container</code> 0N/A * @see java.awt.FlowLayout#setVgap 0N/A * Sets the vertical gap between components and between 0N/A * the components and the borders of the <code>Container</code>. 0N/A * @param vgap the vertical gap between components 0N/A * and between the components and the borders 0N/A * of the <code>Container</code> 0N/A * @see java.awt.FlowLayout#getVgap 0N/A * Sets whether or not components should be vertically aligned along their 0N/A * baseline. Components that do not have a baseline will be centered. 0N/A * The default is false. 0N/A * @param alignOnBaseline whether or not components should be 0N/A * vertically aligned on their baseline 0N/A * Returns true if components are to be vertically aligned along 0N/A * their baseline. The default is false. 0N/A * @return true if components are to be vertically aligned along 0N/A * Adds the specified component to the layout. 0N/A * Not used by this class. 0N/A * @param name the name of the component 0N/A * @param comp the component to be added 0N/A * Removes the specified component from the layout. 0N/A * Not used by this class. 0N/A * @param comp the component to remove 0N/A * @see java.awt.Container#removeAll 0N/A * Returns the preferred dimensions for this layout given the 0N/A * <i>visible</i> components in the specified target container. 0N/A * @param target the container that needs to be laid out 0N/A * @return the preferred dimensions to lay out the 0N/A * subcomponents of the specified container 0N/A * @see #minimumLayoutSize 0N/A * @see java.awt.Container#getPreferredSize 0N/A * Returns the minimum dimensions needed to layout the <i>visible</i> 0N/A * components contained in the specified target container. 0N/A * @param target the container that needs to be laid out 0N/A * @return the minimum dimensions to lay out the 0N/A * subcomponents of the specified container 0N/A * @see #preferredLayoutSize 0N/A * @see java.awt.Container 0N/A * @see java.awt.Container#doLayout 0N/A * Centers the elements in the specified row, if there is any slack. 0N/A * @param target the component which needs to be moved 0N/A * @param x the x coordinate 0N/A * @param y the y coordinate 0N/A * @param width the width dimensions 0N/A * @param height the height dimensions 0N/A * @param rowStart the beginning of the row 0N/A * @param rowEnd the the ending of the row 0N/A * @param useBaseline Whether or not to align on baseline. 0N/A * @param ascent Ascent for the components. This is only valid if 0N/A * useBaseline is true. 0N/A * @param descent Ascent for the components. This is only valid if 0N/A * useBaseline is true. 0N/A * @return actual row height 0N/A * Lays out the container. This method lets each 0N/A * <i>visible</i> component take 0N/A * its preferred size by reshaping the components in the 0N/A * target container in order to satisfy the alignment of 0N/A * this <code>FlowLayout</code> object. 0N/A * @param target the specified component being laid out 0N/A * @see java.awt.Container#doLayout 0N/A // the internal serial version which says which version was written 0N/A // - 0 (default) for versions before the Java 2 platform, v1.2 0N/A // - 1 for version >= Java 2 platform v1.2, which includes "newAlign" field 0N/A * This represent the <code>currentSerialVersion</code> 0N/A * which is bein used. It will be one of two values : 0N/A * <code>0</code> versions before Java 2 platform v1.2.. 0N/A * <code>1</code> versions after Java 2 platform v1.2.. 0N/A * Reads this object out of a serialization stream, handling 0N/A * objects written by older versions of the class that didn't contain all 0N/A * of the fields we use now.. 0N/A // "newAlign" field wasn't present, so use the old "align" field. 0N/A * Returns a string representation of this <code>FlowLayout</code> 0N/A * object and its values. 0N/A * @return a string representation of this layout