src/share/classes/java/awt/GridLayout.java

Print this page




  38  * import java.awt.*;
  39  * import java.applet.Applet;
  40  * public class ButtonGrid extends Applet {
  41  *     public void init() {
  42  *         setLayout(new GridLayout(3,2));
  43  *         add(new Button("1"));
  44  *         add(new Button("2"));
  45  *         add(new Button("3"));
  46  *         add(new Button("4"));
  47  *         add(new Button("5"));
  48  *         add(new Button("6"));
  49  *     }
  50  * }
  51  * </pre></blockquote><hr>
  52  * <p>
  53  * If the container's <code>ComponentOrientation</code> property is horizontal
  54  * and left-to-right, the above example produces the output shown in Figure 1.
  55  * If the container's <code>ComponentOrientation</code> property is horizontal
  56  * and right-to-left, the example produces the output shown in Figure 2.
  57  * <p>
  58  * <center><table COLS=2 WIDTH=600 summary="layout">
  59  * <tr ALIGN=CENTER>
  60  * <td><img SRC="doc-files/GridLayout-1.gif"
  61  *      alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 1 then 2.
  62  * Row 2 shows buttons 3 then 4. Row 3 shows buttons 5 then 6.">
  63  * </td>
  64  *
  65  * <td ALIGN=CENTER><img SRC="doc-files/GridLayout-2.gif"
  66  *                   alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 2 then 1.
  67  * Row 2 shows buttons 4 then 3. Row 3 shows buttons 6 then 5.">
  68  * </td>
  69  * </tr>
  70  *
  71  * <tr ALIGN=CENTER>
  72  * <td>Figure 1: Horizontal, Left-to-Right</td>
  73  *
  74  * <td>Figure 2: Horizontal, Right-to-Left</td>
  75  * </tr>
  76  * </table></center>
  77  * <p>
  78  * When both the number of rows and the number of columns have




  38  * import java.awt.*;
  39  * import java.applet.Applet;
  40  * public class ButtonGrid extends Applet {
  41  *     public void init() {
  42  *         setLayout(new GridLayout(3,2));
  43  *         add(new Button("1"));
  44  *         add(new Button("2"));
  45  *         add(new Button("3"));
  46  *         add(new Button("4"));
  47  *         add(new Button("5"));
  48  *         add(new Button("6"));
  49  *     }
  50  * }
  51  * </pre></blockquote><hr>
  52  * <p>
  53  * If the container's <code>ComponentOrientation</code> property is horizontal
  54  * and left-to-right, the above example produces the output shown in Figure 1.
  55  * If the container's <code>ComponentOrientation</code> property is horizontal
  56  * and right-to-left, the example produces the output shown in Figure 2.
  57  * <p>
  58  * <center><table WIDTH=600 summary="layout">
  59  * <tr ALIGN=CENTER>
  60  * <td><img SRC="doc-files/GridLayout-1.gif"
  61  *      alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 1 then 2.
  62  * Row 2 shows buttons 3 then 4. Row 3 shows buttons 5 then 6.">
  63  * </td>
  64  *
  65  * <td ALIGN=CENTER><img SRC="doc-files/GridLayout-2.gif"
  66  *                   alt="Shows 6 buttons in rows of 2. Row 1 shows buttons 2 then 1.
  67  * Row 2 shows buttons 4 then 3. Row 3 shows buttons 6 then 5.">
  68  * </td>
  69  * </tr>
  70  *
  71  * <tr ALIGN=CENTER>
  72  * <td>Figure 1: Horizontal, Left-to-Right</td>
  73  *
  74  * <td>Figure 2: Horizontal, Right-to-Left</td>
  75  * </tr>
  76  * </table></center>
  77  * <p>
  78  * When both the number of rows and the number of columns have