All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.awt.FlowLayout Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
/*

NOTICE


(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.

Neither this file nor any files generated from it describe a complete specification, and they may only be used as described below. For example, no permission is given for you to incorporate this file, in whole or in part, in an implementation of a Java specification.

Sun Microsystems Inc. owns the copyright in this file and it is provided to you for informative, as opposed to normative, use. The file and any files generated from it may be used to generate other informative documentation, such as a unified set of documents of API signatures for a platform that includes technologies expressed as Java APIs. The file may also be used to produce "compilation stubs," which allow applications to be compiled and validated for such platforms.

Any work generated from this file, such as unified javadocs or compiled stub files, must be accompanied by this notice in its entirety.

This work corresponds to the API signatures of JSR 217: Personal Basis Profile 1.1. In the event of a discrepency between this work and the JSR 217 specification, which is available at http://www.jcp.org/en/jsr/detail?id=217, the latter takes precedence. */ package java.awt; import java.io.ObjectInputStream; import java.io.IOException; /** * A flow layout arranges components in a left-to-right flow, much * like lines of text in a paragraph. Flow layouts are typically used * to arrange buttons in a panel. It will arrange * buttons left to right until no more buttons fit on the same line. * Each line is centered. *

* For example, the following picture shows an applet using the flow * layout manager (its default layout manager) to position three buttons: *

* Graphic of Layout for Three Buttons *

* Here is the code for this applet: *

* * Note: The following code example includes classes that do not * appear in this specification. Their inclusion is purely to serve as * a demonstration.

* * *


 
 * import java.awt.*; 
 * import java.applet.Applet;
 *
 * public class myButtons extends Applet {
 *     Button button1, button2, button3;
 *     public void init() {
 *         button1 = new Button("Ok");
 *         button2 = new Button("Open");
 *         button3 = new Button("Close");
 *         add(button1);
 *         add(button2);
 *         add(button3);
 *     }
 * }
 * 

*

* A flow layout lets each component assume its natural (preferred) size. * * @version 1.46, 01/23/03 * @author Arthur van Hoff * @author Sami Shaio * @since JDK1.0 */ public class FlowLayout implements LayoutManager, java.io.Serializable { /** * This value indicates that each row of components * should be left-justified. */ public static final int LEFT = 0; /** * This value indicates that each row of components * should be centered. */ public static final int CENTER = 1; /** * This value indicates that each row of components * should be right-justified. */ public static final int RIGHT = 2; // /** // * This value indicates that each row of components // * should be justified to the leading edge of the container's // * orientation, for example, to the left in left-to-right orientations. // * // * @see java.awt.Component#getComponentOrientation // * @see java.awt.ComponentOrientation // * @since 1.2 // * Package-private pending API change approval // */ // public static final int LEADING = 3; // /** // * This value indicates that each row of components // * should be justified to the trailing edge of the container's // * orientation, for example, to the right in left-to-right orientations. // * // * @see java.awt.Component#getComponentOrientation // * @see java.awt.ComponentOrientation // * @since 1.2 // * Package-private pending API change approval // */ // public static final int TRAILING = 4; // PBP/PP 6203783 /** * align is the property that determines * how each row distributes empty space. * It can be one of the following values: *

    * LEFT * RIGHT * CENTER * *
* * @serial * @see #getAlignment * @see #setAlignment */ int align; // PBP/PP // [6246075] // /** // * newAlign is the property that determines // * how each row distributes empty space for the Java 2 platform, // * v1.2 and greater. // * It can be one of the following three values: // *
    // * LEFT // * RIGHT // * CENTER // * // *
// * // * @serial // * @since 1.2 // * @see #getAlignment // * @see #setAlignment // */ // int newAlign; /** * The flow layout manager allows a seperation of * components with gaps. The horizontal gap will * specify the space between components. * * @serial * @see #getHgap() * @see #setHgap(int) */ int hgap; /** * The flow layout manager allows a seperation of * components with gaps. The vertical gap will * specify the space between rows. * * @serial * @see #getHgap() * @see #setHgap(int) */ int vgap; /* * JDK 1.1 serialVersionUID */ private static final long serialVersionUID = -7262534875583282631L; // PBP/PP // [6246075] // /** // * This represent the currentSerialVersion // * which is bein used. It will be one of two values : // * 0 versions before Java 2 platform v1.2.. // * 1 versions after Java 2 platform v1.2.. // * // * @serial // * @since 1.2 // */ // private int serialVersionOnStream; /** * Constructs a new FlowLayout with a centered alignment and a * default 5-unit horizontal and vertical gap. */ public FlowLayout() { } /** * Constructs a new FlowLayout with the specified * alignment and a default 5-unit horizontal and vertical gap. * The value of the alignment argument must be one of * FlowLayout.LEFT, FlowLayout.RIGHT, * or FlowLayout.CENTER. * @param align the alignment value */ public FlowLayout(int align) { } /** * Creates a new flow layout manager with the indicated alignment * and the indicated horizontal and vertical gaps. *

* The value of the alignment argument must be one of * FlowLayout.LEFT, FlowLayout.RIGHT, * or FlowLayout.CENTER. * @param align the alignment value * @param hgap the horizontal gap between components * @param vgap the vertical gap between components */ public FlowLayout(int align, int hgap, int vgap) { } // PBP/PP 6203783 /** * Gets the alignment for this layout. * Possible values are FlowLayout.LEFT, * FlowLayout.RIGHT, FlowLayout.CENTER, * * @return the alignment value for this layout * @see java.awt.FlowLayout#setAlignment * @since JDK1.1 */ public int getAlignment() { return 0; } // PBP/PP 6203783 /** * Sets the alignment for this layout. * Possible values are *

    *
  • FlowLayout.LEFT *
  • FlowLayout.RIGHT *
  • FlowLayout.CENTER * *
* @param align one of the alignment values shown above * @see #getAlignment() * @since JDK1.1 */ public void setAlignment(int align) { } /** * Gets the horizontal gap between components. * @return the horizontal gap between components * @see java.awt.FlowLayout#setHgap * @since JDK1.1 */ public int getHgap() { return 0; } /** * Sets the horizontal gap between components. * @param hgap the horizontal gap between components * @see java.awt.FlowLayout#getHgap * @since JDK1.1 */ public void setHgap(int hgap) { } /** * Gets the vertical gap between components. * @return the vertical gap between components * @see java.awt.FlowLayout#setVgap * @since JDK1.1 */ public int getVgap() { return 0; } /** * Sets the vertical gap between components. * @param vgap the vertical gap between components * @see java.awt.FlowLayout#getVgap * @since JDK1.1 */ public void setVgap(int vgap) { } /** * Adds the specified component to the layout. Not used by this class. * @param name the name of the component * @param comp the component to be added */ public void addLayoutComponent(String name, Component comp) { } /** * Removes the specified component from the layout. Not used by * this class. * @param comp the component to remove * @see java.awt.Container#removeAll */ public void removeLayoutComponent(Component comp) { } /** * Returns the preferred dimensions for this layout given the * visible components in the specified target container. * @param target the component which needs to be laid out * @return the preferred dimensions to lay out the * subcomponents of the specified container * @see Container * @see #minimumLayoutSize * @see java.awt.Container#getPreferredSize */ public Dimension preferredLayoutSize(Container target) { return null; } /** * Returns the minimum dimensions needed to layout the visible * components contained in the specified target container. * @param target the component which needs to be laid out * @return the minimum dimensions to lay out the * subcomponents of the specified container * @see #preferredLayoutSize * @see java.awt.Container * @see java.awt.Container#doLayout */ public Dimension minimumLayoutSize(Container target) { return null; } /** * Lays out the container. This method lets each component take * its preferred size by reshaping the components in the * target container in order to satisfy the alignment of * this FlowLayout object. * @param target the specified component being laid out * @see Container * @see java.awt.Container#doLayout */ public void layoutContainer(Container target) { } /** * Returns a string representation of this FlowLayout * object and its values. * @return a string representation of this layout */ public String toString() { return null; } // /** // * Reads this object out of a serialization stream, handling // * objects written by older versions of the class that didn't contain all // * of the fields we use now.. // */ // private void readObject(ObjectInputStream stream) // throws IOException, ClassNotFoundException // { } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy