2362N/A * Copyright (c) 1997, 2007, 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 lightweight container 0N/A * that uses a BoxLayout object as its layout manager. 0N/A * Box provides several class methods 0N/A * that are useful for containers using BoxLayout -- 0N/A * even non-Box containers. 0N/A * The <code>Box</code> class can create several kinds 0N/A * of invisible components 0N/A * that affect layout: 0N/A * glue, struts, and rigid areas. 0N/A * If all the components your <code>Box</code> contains 0N/A * have a fixed size, 0N/A * you might want to use a glue component 0N/A * (returned by <code>createGlue</code>) 0N/A * to control the components' positions. 0N/A * If you need a fixed amount of space between two components, 0N/A * (<code>createHorizontalStrut</code> or <code>createVerticalStrut</code>). 0N/A * If you need an invisible component 0N/A * that always takes up the same amount of space, 0N/A * get it by invoking <code>createRigidArea</code>. 0N/A * If you are implementing a <code>BoxLayout</code> you 0N/A * can find further information and examples in 0N/A * a section in <em>The Java Tutorial.</em> 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @author Timothy Prinzing 0N/A * Creates a <code>Box</code> that displays its components 0N/A * along the the specified axis. 0N/A * @param axis can be {@link BoxLayout#X_AXIS}, 0N/A * {@link BoxLayout#Y_AXIS}, 0N/A * {@link BoxLayout#LINE_AXIS} or 0N/A * {@link BoxLayout#PAGE_AXIS}. 0N/A * @throws AWTError if the <code>axis</code> is invalid 0N/A * @see #createHorizontalBox 0N/A * @see #createVerticalBox 0N/A * Creates a <code>Box</code> that displays its components 0N/A * from left to right. If you want a <code>Box</code> that 0N/A * respects the component orientation you should create the 0N/A * <code>Box</code> using the constructor and pass in 0N/A * <code>BoxLayout.LINE_AXIS</code>, eg: 0N/A * Box lineBox = new Box(BoxLayout.LINE_AXIS); 0N/A * Creates a <code>Box</code> that displays its components 0N/A * from top to bottom. If you want a <code>Box</code> that 0N/A * respects the component orientation you should create the 0N/A * <code>Box</code> using the constructor and pass in 0N/A * <code>BoxLayout.PAGE_AXIS</code>, eg: 0N/A * Box lineBox = new Box(BoxLayout.PAGE_AXIS); 0N/A * Creates an invisible component that's always the specified size. 0N/A * <!-- WHEN WOULD YOU USE THIS AS OPPOSED TO A STRUT? --> 0N/A * @param d the dimensions of the invisible component 0N/A * @return the component 0N/A * @see #createHorizontalStrut 0N/A * @see #createVerticalStrut 0N/A * Creates an invisible, fixed-width component. 0N/A * In a horizontal box, 0N/A * you typically use this method 0N/A * to force a certain amount of space between two components. 0N/A * In a vertical box, 0N/A * you might use this method 0N/A * to force the box to be at least the specified width. 0N/A * The invisible component has no height 0N/A * unless excess space is available, 0N/A * in which case it takes its share of available space, 0N/A * just like any other component that has no maximum height. 0N/A * @param width the width of the invisible component, in pixels >= 0 0N/A * @return the component 0N/A * @see #createVerticalStrut 0N/A * @see #createRigidArea 0N/A * Creates an invisible, fixed-height component. 0N/A * In a vertical box, 0N/A * you typically use this method 0N/A * to force a certain amount of space between two components. 0N/A * In a horizontal box, 0N/A * you might use this method 0N/A * to force the box to be at least the specified height. 0N/A * The invisible component has no width 0N/A * unless excess space is available, 0N/A * in which case it takes its share of available space, 0N/A * just like any other component that has no maximum width. 0N/A * @param height the height of the invisible component, in pixels >= 0 0N/A * @return the component 0N/A * @see #createHorizontalStrut 0N/A * @see #createRigidArea 0N/A * Creates an invisible "glue" component 0N/A * that can be useful in a Box 0N/A * whose visible components have a maximum width 0N/A * (for a horizontal box) 0N/A * or height (for a vertical box). 0N/A * You can think of the glue component 0N/A * as being a gooey substance 0N/A * that expands as much as necessary 0N/A * to fill the space between its neighboring components. 0N/A * For example, suppose you have 0N/A * a horizontal box that contains two fixed-size components. 0N/A * If the box gets extra space, 0N/A * the fixed-size components won't become larger, 0N/A * so where does the extra space go? 0N/A * the extra space goes to the right of the second component. 0N/A * If you put glue between the fixed-size components, 0N/A * then the extra space goes there. 0N/A * If you put glue before the first fixed-size component, 0N/A * the extra space goes there, 0N/A * and the fixed-size components are shoved against the right 0N/A * If you put glue before the first fixed-size component 0N/A * and after the second fixed-size component, 0N/A * the fixed-size components are centered in the box. 0N/A * call <code>Box.createGlue</code> 0N/A * and add the returned component to a container. 0N/A * The glue component has no minimum or preferred size, 0N/A * so it takes no space unless excess space is available. 0N/A * If excess space is available, 0N/A * then the glue component takes its share of available 0N/A * horizontal or vertical space, 0N/A * just like any other component that has no maximum width or height. 0N/A * @return the component 0N/A * Creates a horizontal glue component. 0N/A * @return the component 0N/A * Creates a vertical glue component. 0N/A * @return the component 0N/A * Throws an AWTError, since a Box can use only a BoxLayout. 0N/A * @param l the layout manager to use 0N/A * Paints this <code>Box</code>. If this <code>Box</code> has a UI this 0N/A * method invokes super's implementation, otherwise if this 0N/A * <code>Box</code> is opaque the <code>Graphics</code> is filled 0N/A * using the background. 0N/A * @param g the <code>Graphics</code> to paint to 0N/A * @throws NullPointerException if <code>g</code> is null 0N/A // On the off chance some one created a UI, honor it 0N/A * An implementation of a lightweight component that participates in 0N/A * layout but has no view. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * Constructor to create shape with the given size ranges. 0N/A * @param min Minimum size 0N/A * @param pref Preferred size 0N/A * @param max Maximum size 0N/A * Change the size requests for this shape. An invalidate() is 0N/A * propagated upward as a result so that layout will eventually 0N/A * happen with using the new sizes. 0N/A * @param min Value to return for getMinimumSize 0N/A * @param pref Value to return for getPreferredSize 0N/A * @param max Value to return for getMaximumSize 0N/A // ---- Component methods ------------------------------------------ 0N/A * Paints this <code>Filler</code>. If this 0N/A * <code>Filler</code> has a UI this method invokes super's 0N/A * implementation, otherwise if this <code>Filler</code> is 0N/A * opaque the <code>Graphics</code> is filled using the 0N/A * @param g the <code>Graphics</code> to paint to 0N/A * @throws NullPointerException if <code>g</code> is null 0N/A // On the off chance some one created a UI, honor it 0N/A// Accessibility support for Box$Filler 0N/A * Gets the AccessibleContext associated with this Box.Filler. 0N/A * For box fillers, the AccessibleContext takes the form of an 0N/A * AccessibleBoxFiller. 0N/A * A new AccessibleAWTBoxFiller instance is created if necessary. 0N/A * @return an AccessibleBoxFiller that serves as the 0N/A * AccessibleContext of this Box.Filler. 0N/A * This class implements accessibility support for the 0N/A * <code>Box.Filler</code> class. 0N/A // AccessibleContext methods 0N/A * Gets the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of 0N/A * the object (AccessibleRole.FILLER) 0N/A * @see AccessibleRole 0N/A// Accessibility support for Box 0N/A * Gets the AccessibleContext associated with this Box. 0N/A * For boxes, the AccessibleContext takes the form of an 0N/A * A new AccessibleAWTBox instance is created if necessary. 0N/A * @return an AccessibleBox that serves as the 0N/A * AccessibleContext of this Box 0N/A * This class implements accessibility support for the 0N/A * <code>Box</code> class. 0N/A // AccessibleContext methods 0N/A * Gets the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the 0N/A * object (AccessibleRole.FILLER) 0N/A * @see AccessibleRole 0N/A }
// inner class AccessibleBox