* <code>BoxLayout.X_AXIS</code>,
* <code>BoxLayout.Y_AXIS</code>,
* <code>BoxLayout.LINE_AXIS</code> or
* <code>BoxLayout.PAGE_AXIS</code>
*
* @return the axis that was used to lay out components
*
* @since 1.6
*/
public final int getAxis() {
return this.axis;
}
/**
* Indicates that a child has changed its layout related information,
* and thus any cached calculations should be flushed.
* <p>
* This method is called by AWT when the invalidate method is called
* on the Container. Since the invalidate method may be called
* asynchronously to the event thread, this method may be called
* asynchronously.
*
* @param target the affected container
*
* @exception AWTError if the target isn't the container specified to the
* BoxLayout constructor
*/
public synchronized void invalidateLayout(Container target) {
checkContainer(target);
xChildren = null;
yChildren = null;
xTotal = null;
yTotal = null;
}
/**
* Not used by this class.
*
* @param name the name of the component
* @param comp the component
*/
public void addLayoutComponent(String name, Component comp) {
invalidateLayout(comp.getParent());
}
/**
* Not used by this class.
*
* @param comp the component
*/
public void removeLayoutComponent(Component comp) {
invalidateLayout(comp.getParent());
}
/**
* Not used by this class.
*
* @param comp the component
* @param constraints constraints
*/
public void addLayoutComponent(Component comp, Object constraints) {
invalidateLayout(comp.getParent());
}
/**
* Returns the preferred dimensions for this layout, given the components
* in the specified target container.
*
* @param target the container that needs to be laid out
* @return the dimensions >= 0 && <= Integer.MAX_VALUE
* @exception AWTError if the target isn't the container specified to the
* BoxLayout constructor
* @see Container
* @see #minimumLayoutSize
* @see #maximumLayoutSize
*/
public Dimension preferredLayoutSize(Container target) {
Dimension size;
synchronized(this) {
checkContainer(target);
checkRequests();
size = new Dimension(xTotal.preferred, yTotal.preferred);
}
Insets insets = target.getInsets();
size.width = (int) Math.min((long) size.width + (long) insets.left + (long) insets.right, Integer.MAX_VALUE);
size.height = (int) Math.min((long) size.height + (long) insets.top + (long) insets.bottom, Integer.MAX_VALUE);
return size;
}
/**
* Returns the minimum dimensions needed to lay out the components
* contained in the specified target container.
*
* @param target the container that needs to be laid out
* @return the dimensions >= 0 && <= Integer.MAX_VALUE
* @exception AWTError if the target isn't the container specified to the
* BoxLayout constructor
* @see #preferredLayoutSize
* @see #maximumLayoutSize
=3= |