1 /* 2 * Copyright (c) 1997, 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 23 * questions. 24 */ 25 26 27 package javax.swing; 28 29 import java.awt.*; 30 import java.beans.ConstructorProperties; 31 import java.io.Serializable; 32 import java.io.PrintStream; 33 34 /** 35 * A layout manager that allows multiple components to be laid out either 36 * vertically or horizontally. The components will not wrap so, for 37 * example, a vertical arrangement of components will stay vertically 38 * arranged when the frame is resized. 39 * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout"> 40 * <TR> 41 * <TD ALIGN="CENTER"> 42 * <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/BoxLayout-1.gif" 43 * alt="The following text describes this graphic." 44 * WIDTH="191" HEIGHT="201" STYLE="FLOAT:BOTTOM; BORDER:0"> 45 * </TD> 46 * </TR> 47 * </TABLE> 48 * <p> 49 * Nesting multiple panels with different combinations of horizontal and 50 * vertical gives an effect similar to GridBagLayout, without the 51 * complexity. The diagram shows two panels arranged horizontally, each 52 * of which contains 3 components arranged vertically. 53 * 54 * <p> The BoxLayout manager is constructed with an axis parameter that 55 * specifies the type of layout that will be done. There are four choices: 56 * 57 * <blockquote><b>{@code X_AXIS}</b> - Components are laid out horizontally 58 * from left to right.</blockquote> 59 * 60 * <blockquote><b>{@code Y_AXIS}</b> - Components are laid out vertically 61 * from top to bottom.</blockquote> | 1 /* 2 * Copyright (c) 1997, 2017, 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 23 * questions. 24 */ 25 26 27 package javax.swing; 28 29 import java.awt.*; 30 import java.beans.ConstructorProperties; 31 import java.io.Serializable; 32 import java.io.PrintStream; 33 34 /** 35 * A layout manager that allows multiple components to be laid out either 36 * vertically or horizontally. The components will not wrap so, for 37 * example, a vertical arrangement of components will stay vertically 38 * arranged when the frame is resized. 39 * <TABLE STYLE="FLOAT:RIGHT" BORDER="0" SUMMARY="layout"> 40 * <TR> 41 * <TD style="text-align:center"> 42 * <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/BoxLayout-1.gif" 43 * alt="The following text describes this graphic." 44 * WIDTH="191" HEIGHT="201" STYLE="FLOAT:BOTTOM; BORDER:0"> 45 * </TD> 46 * </TR> 47 * </TABLE> 48 * <p> 49 * Nesting multiple panels with different combinations of horizontal and 50 * vertical gives an effect similar to GridBagLayout, without the 51 * complexity. The diagram shows two panels arranged horizontally, each 52 * of which contains 3 components arranged vertically. 53 * 54 * <p> The BoxLayout manager is constructed with an axis parameter that 55 * specifies the type of layout that will be done. There are four choices: 56 * 57 * <blockquote><b>{@code X_AXIS}</b> - Components are laid out horizontally 58 * from left to right.</blockquote> 59 * 60 * <blockquote><b>{@code Y_AXIS}</b> - Components are laid out vertically 61 * from top to bottom.</blockquote> |