0N/A/*
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 *
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 *
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 *
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.
0N/A *
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
2362N/A * questions.
0N/A */
0N/Apackage java.awt;
0N/A
0N/Aimport java.io.ObjectInputStream;
0N/Aimport java.io.IOException;
0N/A
0N/A/**
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 * <ul>
0N/A * <li><code>ComponentOrientation.LEFT_TO_RIGHT</code>
0N/A * <li><code>ComponentOrientation.RIGHT_TO_LEFT</code>
0N/A * </ul>
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 * <ul>
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 * </ul>
0N/A * <p>
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 * <p>
0N/A * <img src="doc-files/FlowLayout-1.gif"
0N/A * ALT="Graphic of Layout for Three Buttons"
0N/A * ALIGN=center HSPACE=10 VSPACE=7>
0N/A * <p>
0N/A * Here is the code for this applet:
0N/A * <p>
0N/A * <hr><blockquote><pre>
0N/A * import java.awt.*;
0N/A * import java.applet.Applet;
0N/A *
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 * add(button1);
0N/A * add(button2);
0N/A * add(button3);
0N/A * }
0N/A * }
0N/A * </pre></blockquote><hr>
0N/A * <p>
0N/A * A flow layout lets each component assume its natural (preferred) size.
0N/A *
0N/A * @author Arthur van Hoff
0N/A * @author Sami Shaio
0N/A * @since JDK1.0
0N/A * @see ComponentOrientation
0N/A */
0N/Apublic class FlowLayout implements LayoutManager, java.io.Serializable {
0N/A
0N/A /**
0N/A * This value indicates that each row of components
0N/A * should be left-justified.
0N/A */
0N/A public static final int LEFT = 0;
0N/A
0N/A /**
0N/A * This value indicates that each row of components
0N/A * should be centered.
0N/A */
0N/A public static final int CENTER = 1;
0N/A
0N/A /**
0N/A * This value indicates that each row of components
0N/A * should be right-justified.
0N/A */
0N/A public static final int RIGHT = 2;
0N/A
0N/A /**
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 *
0N/A * @see java.awt.Component#getComponentOrientation
0N/A * @see java.awt.ComponentOrientation
0N/A * @since 1.2
0N/A */
0N/A public static final int LEADING = 3;
0N/A
0N/A /**
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 *
0N/A * @see java.awt.Component#getComponentOrientation
0N/A * @see java.awt.ComponentOrientation
0N/A * @since 1.2
0N/A */
0N/A public static final int TRAILING = 4;
0N/A
0N/A /**
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 * <ul>
0N/A * <code>LEFT</code>
0N/A * <code>RIGHT</code>
0N/A * <code>CENTER</code>
0N/A * </ul>
0N/A *
0N/A * @serial
0N/A * @see #getAlignment
0N/A * @see #setAlignment
0N/A */
0N/A int align; // This is for 1.1 serialization compatibility
0N/A
0N/A /**
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 * v1.2 and greater.
0N/A * It can be one of the following three values:
0N/A * <ul>
0N/A * <code>LEFT</code>
0N/A * <code>RIGHT</code>
0N/A * <code>CENTER</code>
0N/A * <code>LEADING</code>
0N/A * <code>TRAILING</code>
0N/A * </ul>
0N/A *
0N/A * @serial
0N/A * @since 1.2
0N/A * @see #getAlignment
0N/A * @see #setAlignment
0N/A */
0N/A int newAlign; // This is the one we actually use
0N/A
0N/A /**
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 *
0N/A * @serial
0N/A * @see #getHgap()
0N/A * @see #setHgap(int)
0N/A */
0N/A int hgap;
0N/A
0N/A /**
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 *
0N/A * @serial
0N/A * @see #getHgap()
0N/A * @see #setHgap(int)
0N/A */
0N/A int vgap;
0N/A
0N/A /**
0N/A * If true, components will be aligned on their baseline.
0N/A */
0N/A private boolean alignOnBaseline;
0N/A
0N/A /*
0N/A * JDK 1.1 serialVersionUID
0N/A */
0N/A private static final long serialVersionUID = -7262534875583282631L;
0N/A
0N/A /**
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 */
0N/A public FlowLayout() {
0N/A this(CENTER, 5, 5);
0N/A }
0N/A
0N/A /**
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 */
0N/A public FlowLayout(int align) {
0N/A this(align, 5, 5);
0N/A }
0N/A
0N/A /**
0N/A * Creates a new flow layout manager with the indicated alignment
0N/A * and the indicated horizontal and vertical gaps.
0N/A * <p>
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 */
0N/A public FlowLayout(int align, int hgap, int vgap) {
0N/A this.hgap = hgap;
0N/A this.vgap = vgap;
0N/A setAlignment(align);
0N/A }
0N/A
0N/A /**
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 * @since JDK1.1
0N/A */
0N/A public int getAlignment() {
0N/A return newAlign;
0N/A }
0N/A
0N/A /**
0N/A * Sets the alignment for this layout.
0N/A * Possible values are
0N/A * <ul>
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 * </ul>
0N/A * @param align one of the alignment values shown above
0N/A * @see #getAlignment()
0N/A * @since JDK1.1
0N/A */
0N/A public void setAlignment(int align) {
0N/A this.newAlign = align;
0N/A
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 // of the class
0N/A
0N/A switch (align) {
0N/A case LEADING:
0N/A this.align = LEFT;
0N/A break;
0N/A case TRAILING:
0N/A this.align = RIGHT;
0N/A break;
0N/A default:
0N/A this.align = align;
0N/A break;
0N/A }
0N/A }
0N/A
0N/A /**
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 *
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 * @since JDK1.1
0N/A */
0N/A public int getHgap() {
0N/A return hgap;
0N/A }
0N/A
0N/A /**
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 *
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 * @since JDK1.1
0N/A */
0N/A public void setHgap(int hgap) {
0N/A this.hgap = hgap;
0N/A }
0N/A
0N/A /**
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 *
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 * @since JDK1.1
0N/A */
0N/A public int getVgap() {
0N/A return vgap;
0N/A }
0N/A
0N/A /**
0N/A * Sets the vertical gap between components and between
0N/A * the components and the borders of the <code>Container</code>.
0N/A *
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 * @since JDK1.1
0N/A */
0N/A public void setVgap(int vgap) {
0N/A this.vgap = vgap;
0N/A }
0N/A
0N/A /**
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 *
0N/A * @param alignOnBaseline whether or not components should be
0N/A * vertically aligned on their baseline
0N/A * @since 1.6
0N/A */
0N/A public void setAlignOnBaseline(boolean alignOnBaseline) {
0N/A this.alignOnBaseline = alignOnBaseline;
0N/A }
0N/A
0N/A /**
0N/A * Returns true if components are to be vertically aligned along
0N/A * their baseline. The default is false.
0N/A *
0N/A * @return true if components are to be vertically aligned along
0N/A * their baseline
0N/A * @since 1.6
0N/A */
0N/A public boolean getAlignOnBaseline() {
0N/A return alignOnBaseline;
0N/A }
0N/A
0N/A /**
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 */
0N/A public void addLayoutComponent(String name, Component comp) {
0N/A }
0N/A
0N/A /**
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 */
0N/A public void removeLayoutComponent(Component comp) {
0N/A }
0N/A
0N/A /**
0N/A * Returns the preferred dimensions for this layout given the
0N/A * <i>visible</i> components in the specified target container.
0N/A *
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 Container
0N/A * @see #minimumLayoutSize
0N/A * @see java.awt.Container#getPreferredSize
0N/A */
0N/A public Dimension preferredLayoutSize(Container target) {
0N/A synchronized (target.getTreeLock()) {
0N/A Dimension dim = new Dimension(0, 0);
0N/A int nmembers = target.getComponentCount();
0N/A boolean firstVisibleComponent = true;
0N/A boolean useBaseline = getAlignOnBaseline();
0N/A int maxAscent = 0;
0N/A int maxDescent = 0;
0N/A
0N/A for (int i = 0 ; i < nmembers ; i++) {
0N/A Component m = target.getComponent(i);
0N/A if (m.isVisible()) {
0N/A Dimension d = m.getPreferredSize();
0N/A dim.height = Math.max(dim.height, d.height);
0N/A if (firstVisibleComponent) {
0N/A firstVisibleComponent = false;
0N/A } else {
0N/A dim.width += hgap;
0N/A }
0N/A dim.width += d.width;
0N/A if (useBaseline) {
0N/A int baseline = m.getBaseline(d.width, d.height);
0N/A if (baseline >= 0) {
0N/A maxAscent = Math.max(maxAscent, baseline);
0N/A maxDescent = Math.max(maxDescent, d.height - baseline);
0N/A }
0N/A }
0N/A }
0N/A }
0N/A if (useBaseline) {
0N/A dim.height = Math.max(maxAscent + maxDescent, dim.height);
0N/A }
0N/A Insets insets = target.getInsets();
0N/A dim.width += insets.left + insets.right + hgap*2;
0N/A dim.height += insets.top + insets.bottom + vgap*2;
0N/A return dim;
0N/A }
0N/A }
0N/A
0N/A /**
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 */
0N/A public Dimension minimumLayoutSize(Container target) {
0N/A synchronized (target.getTreeLock()) {
0N/A boolean useBaseline = getAlignOnBaseline();
0N/A Dimension dim = new Dimension(0, 0);
0N/A int nmembers = target.getComponentCount();
0N/A int maxAscent = 0;
0N/A int maxDescent = 0;
0N/A boolean firstVisibleComponent = true;
0N/A
0N/A for (int i = 0 ; i < nmembers ; i++) {
0N/A Component m = target.getComponent(i);
0N/A if (m.visible) {
0N/A Dimension d = m.getMinimumSize();
0N/A dim.height = Math.max(dim.height, d.height);
0N/A if (firstVisibleComponent) {
0N/A firstVisibleComponent = false;
0N/A } else {
0N/A dim.width += hgap;
0N/A }
0N/A dim.width += d.width;
0N/A if (useBaseline) {
0N/A int baseline = m.getBaseline(d.width, d.height);
0N/A if (baseline >= 0) {
0N/A maxAscent = Math.max(maxAscent, baseline);
0N/A maxDescent = Math.max(maxDescent,
0N/A dim.height - baseline);
0N/A }
0N/A }
0N/A}
0N/A}
0N/A
0N/A if (useBaseline) {
0N/A dim.height = Math.max(maxAscent + maxDescent, dim.height);
0N/A }
0N/A
0N/A Insets insets = target.getInsets();
0N/A dim.width += insets.left + insets.right + hgap*2;
0N/A dim.height += insets.top + insets.bottom + vgap*2;
0N/A return dim;
0N/A
0N/A
0N/A
0N/A
0N/A
0N/A }
0N/A }
0N/A
0N/A /**
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 */
0N/A private int moveComponents(Container target, int x, int y, int width, int height,
0N/A int rowStart, int rowEnd, boolean ltr,
0N/A boolean useBaseline, int[] ascent,
0N/A int[] descent) {
0N/A switch (newAlign) {
0N/A case LEFT:
0N/A x += ltr ? 0 : width;
0N/A break;
0N/A case CENTER:
0N/A x += width / 2;
0N/A break;
0N/A case RIGHT:
0N/A x += ltr ? width : 0;
0N/A break;
0N/A case LEADING:
0N/A break;
0N/A case TRAILING:
0N/A x += width;
0N/A break;
0N/A }
0N/A int maxAscent = 0;
0N/A int nonbaselineHeight = 0;
0N/A int baselineOffset = 0;
0N/A if (useBaseline) {
0N/A int maxDescent = 0;
0N/A for (int i = rowStart ; i < rowEnd ; i++) {
0N/A Component m = target.getComponent(i);
0N/A if (m.visible) {
0N/A if (ascent[i] >= 0) {
0N/A maxAscent = Math.max(maxAscent, ascent[i]);
0N/A maxDescent = Math.max(maxDescent, descent[i]);
0N/A }
0N/A else {
0N/A nonbaselineHeight = Math.max(m.getHeight(),
0N/A nonbaselineHeight);
0N/A }
0N/A }
0N/A }
0N/A height = Math.max(maxAscent + maxDescent, nonbaselineHeight);
0N/A baselineOffset = (height - maxAscent - maxDescent) / 2;
0N/A }
0N/A for (int i = rowStart ; i < rowEnd ; i++) {
0N/A Component m = target.getComponent(i);
0N/A if (m.isVisible()) {
0N/A int cy;
0N/A if (useBaseline && ascent[i] >= 0) {
0N/A cy = y + baselineOffset + maxAscent - ascent[i];
0N/A }
0N/A else {
0N/A cy = y + (height - m.height) / 2;
0N/A }
0N/A if (ltr) {
0N/A m.setLocation(x, cy);
0N/A } else {
0N/A m.setLocation(target.width - x - m.width, cy);
0N/A }
0N/A x += m.width + hgap;
0N/A }
0N/A }
0N/A return height;
0N/A }
0N/A
0N/A /**
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 *
0N/A * @param target the specified component being laid out
0N/A * @see Container
0N/A * @see java.awt.Container#doLayout
0N/A */
0N/A public void layoutContainer(Container target) {
0N/A synchronized (target.getTreeLock()) {
0N/A Insets insets = target.getInsets();
0N/A int maxwidth = target.width - (insets.left + insets.right + hgap*2);
0N/A int nmembers = target.getComponentCount();
0N/A int x = 0, y = insets.top + vgap;
0N/A int rowh = 0, start = 0;
0N/A
0N/A boolean ltr = target.getComponentOrientation().isLeftToRight();
0N/A
0N/A boolean useBaseline = getAlignOnBaseline();
0N/A int[] ascent = null;
0N/A int[] descent = null;
0N/A
0N/A if (useBaseline) {
0N/A ascent = new int[nmembers];
0N/A descent = new int[nmembers];
0N/A }
0N/A
0N/A for (int i = 0 ; i < nmembers ; i++) {
0N/A Component m = target.getComponent(i);
0N/A if (m.isVisible()) {
0N/A Dimension d = m.getPreferredSize();
0N/A m.setSize(d.width, d.height);
0N/A
0N/A if (useBaseline) {
0N/A int baseline = m.getBaseline(d.width, d.height);
0N/A if (baseline >= 0) {
0N/A ascent[i] = baseline;
0N/A descent[i] = d.height - baseline;
0N/A }
0N/A else {
0N/A ascent[i] = -1;
0N/A }
0N/A }
0N/A if ((x == 0) || ((x + d.width) <= maxwidth)) {
0N/A if (x > 0) {
0N/A x += hgap;
0N/A }
0N/A x += d.width;
0N/A rowh = Math.max(rowh, d.height);
0N/A } else {
0N/A rowh = moveComponents(target, insets.left + hgap, y,
0N/A maxwidth - x, rowh, start, i, ltr,
0N/A useBaseline, ascent, descent);
0N/A x = d.width;
0N/A y += vgap + rowh;
0N/A rowh = d.height;
0N/A start = i;
0N/A }
0N/A }
0N/A }
0N/A moveComponents(target, insets.left + hgap, y, maxwidth - x, rowh,
0N/A start, nmembers, ltr, useBaseline, ascent, descent);
0N/A }
0N/A }
0N/A
0N/A //
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 //
0N/A private static final int currentSerialVersion = 1;
0N/A /**
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 *
0N/A * @serial
0N/A * @since 1.2
0N/A */
0N/A private int serialVersionOnStream = currentSerialVersion;
0N/A
0N/A /**
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 */
0N/A private void readObject(ObjectInputStream stream)
0N/A throws IOException, ClassNotFoundException
0N/A {
0N/A stream.defaultReadObject();
0N/A
0N/A if (serialVersionOnStream < 1) {
0N/A // "newAlign" field wasn't present, so use the old "align" field.
0N/A setAlignment(this.align);
0N/A }
0N/A serialVersionOnStream = currentSerialVersion;
0N/A }
0N/A
0N/A /**
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
0N/A */
0N/A public String toString() {
0N/A String str = "";
0N/A switch (align) {
0N/A case LEFT: str = ",align=left"; break;
0N/A case CENTER: str = ",align=center"; break;
0N/A case RIGHT: str = ",align=right"; break;
0N/A case LEADING: str = ",align=leading"; break;
0N/A case TRAILING: str = ",align=trailing"; break;
0N/A }
0N/A return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + str + "]";
0N/A }
0N/A
0N/A
0N/A}