javax.swing.plaf.basic

Class BasicSplitPaneUI.BasicHorizontalLayoutManager

Enclosing Class:
BasicSplitPaneUI
Implemented Interfaces:
LayoutManager, LayoutManager2
Known Direct Subclasses:
BasicSplitPaneUI.BasicVerticalLayoutManager

public class BasicSplitPaneUI.BasicHorizontalLayoutManager
extends Object
implements LayoutManager2

This Layout Manager controls the position and size of the components when the JSplitPane's orientation is HORIZONTAL_SPLIT.

Field Summary

protected Component[]
components
This array contains the components in the JSplitPane.
protected int[]
sizes
This array contains the current width (for HORIZONTAL_SPLIT) or height (for VERTICAL_SPLIT) of the components.

Method Summary

void
addLayoutComponent(Component comp, Object constraints)
This method adds the component given to the JSplitPane.
void
addLayoutComponent(String place, Component component)
This method is called to add a Component to the JSplitPane.
protected int
getAvailableSize(Dimension containerSize, Insets insets)
This method returns the width of the JSplitPane minus the insets.
protected int
getInitialLocation(Insets insets)
This method returns the given insets left value.
float
getLayoutAlignmentX(Container target)
This specifies how a component is aligned with respect to other components in the x fdirection.
float
getLayoutAlignmentY(Container target)
This specifies how a component is aligned with respect to other components in the y direction.
protected int
getPreferredSizeOfComponent(Component c)
This method returns the preferred width of the component.
protected int
getSizeOfComponent(Component c)
This method returns the current width of the component.
protected int[]
getSizes()
This method returns the sizes array.
void
invalidateLayout(Container c)
This method invalidates the layout.
void
layoutContainer(Container container)
This method lays out the components in the container.
Dimension
maximumLayoutSize(Container target)
This method returns the maximum size for the container given the components.
Dimension
minimumLayoutSize(Container target)
This method returns the container's minimum size.
Dimension
preferredLayoutSize(Container target)
This method returns the container's preferred size.
void
removeLayoutComponent(Component component)
This method removes the component from the layout.
protected void
resetSizeAt(int index)
This method resets the size of Component to the preferred size.
void
resetToPreferredSizes()
This method resets the sizes of all the components.
protected void
setComponentToSize(Component c, int size, int location, Insets insets, Dimension containerSize)
This methods sets the bounds of the given component.
protected void
setSizes(int[] newSizes)
This method stores the given int array as the new sizes array.
protected void
updateComponents()
This method determines the size of each component.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

components

protected Component[] components
This array contains the components in the JSplitPane. The left/top component is at index 0, the right/bottom is at 1, and the divider is at 2.

sizes

protected int[] sizes
This array contains the current width (for HORIZONTAL_SPLIT) or height (for VERTICAL_SPLIT) of the components. The indices are the same as for components.

Method Details

addLayoutComponent

public void addLayoutComponent(Component comp,
                               Object constraints)
This method adds the component given to the JSplitPane. The position of the component is given by the constraints object.
Specified by:
addLayoutComponent in interface LayoutManager2
Parameters:
comp - The Component to add.
constraints - The constraints that bind the object.

addLayoutComponent

public void addLayoutComponent(String place,
                               Component component)
This method is called to add a Component to the JSplitPane. The placement string determines where the Component will be placed. The string should be one of LEFT, RIGHT, TOP, BOTTOM or null (signals that the component is the divider).
Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
place - The placement of the Component.
component - The Component to add.
Throws:
IllegalArgumentException - DOCUMENT ME!

getAvailableSize

protected int getAvailableSize(Dimension containerSize,
                               Insets insets)
This method returns the width of the JSplitPane minus the insets.
Parameters:
containerSize - The Dimensions of the JSplitPane.
insets - The Insets of the JSplitPane.
Returns:
The width of the JSplitPane minus the insets.

getInitialLocation

protected int getInitialLocation(Insets insets)
This method returns the given insets left value. If the given inset is null, then 0 is returned.
Parameters:
insets - The Insets to use with the JSplitPane.
Returns:
The inset's left value.

getLayoutAlignmentX

public float getLayoutAlignmentX(Container target)
This specifies how a component is aligned with respect to other components in the x fdirection.
Specified by:
getLayoutAlignmentX in interface LayoutManager2
Parameters:
target - The container.
Returns:
The component's alignment.

getLayoutAlignmentY

public float getLayoutAlignmentY(Container target)
This specifies how a component is aligned with respect to other components in the y direction.
Specified by:
getLayoutAlignmentY in interface LayoutManager2
Parameters:
target - The container.
Returns:
The component's alignment.

getPreferredSizeOfComponent

protected int getPreferredSizeOfComponent(Component c)
This method returns the preferred width of the component.
Parameters:
c - The component to measure.
Returns:
The preferred width of the component.

getSizeOfComponent

protected int getSizeOfComponent(Component c)
This method returns the current width of the component.
Parameters:
c - The component to measure.
Returns:
The width of the component.

getSizes

protected int[] getSizes()
This method returns the sizes array.
Returns:
The sizes array.

invalidateLayout

public void invalidateLayout(Container c)
This method invalidates the layout. It does nothing.
Specified by:
invalidateLayout in interface LayoutManager2
Parameters:
c - The container to invalidate.

layoutContainer

public void layoutContainer(Container container)
This method lays out the components in the container.
Specified by:
layoutContainer in interface LayoutManager
Parameters:
container - The container to lay out.

maximumLayoutSize

public Dimension maximumLayoutSize(Container target)
This method returns the maximum size for the container given the components. It returns a new Dimension object that has width and height equal to Integer.MAX_VALUE.
Specified by:
maximumLayoutSize in interface LayoutManager2
Parameters:
target - The container to measure.
Returns:
The maximum size.

minimumLayoutSize

public Dimension minimumLayoutSize(Container target)
This method returns the container's minimum size. The minimum width is the sum of all the component's minimum widths. The minimum height is the maximum of all the components' minimum heights.
Specified by:
minimumLayoutSize in interface LayoutManager
Parameters:
target - The container to measure.
Returns:
The minimum size.

preferredLayoutSize

public Dimension preferredLayoutSize(Container target)
This method returns the container's preferred size. The preferred width is the sum of all the component's preferred widths. The preferred height is the maximum of all the components' preferred heights.
Specified by:
preferredLayoutSize in interface LayoutManager
Parameters:
target - The container to measure.
Returns:
The preferred size.

removeLayoutComponent

public void removeLayoutComponent(Component component)
This method removes the component from the layout.
Specified by:
removeLayoutComponent in interface LayoutManager
Parameters:
component - The component to remove from the layout.

resetSizeAt

protected void resetSizeAt(int index)
This method resets the size of Component to the preferred size.
Parameters:
index - The index of the component to reset.

resetToPreferredSizes

public void resetToPreferredSizes()
This method resets the sizes of all the components.

setComponentToSize

protected void setComponentToSize(Component c,
                                  int size,
                                  int location,
                                  Insets insets,
                                  Dimension containerSize)
This methods sets the bounds of the given component. The width is the size. The height is the container size minus the top and bottom inset. The x coordinate is the location given. The y coordinate is the top inset.
Parameters:
c - The component to set.
size - The width of the component.
location - The x coordinate.
insets - The insets to use.
containerSize - The height of the container.

setSizes

protected void setSizes(int[] newSizes)
This method stores the given int array as the new sizes array.
Parameters:
newSizes - The array to use as sizes.

updateComponents

protected void updateComponents()
This method determines the size of each component. It should be called when a new Layout Manager is created for an existing JSplitPane.

BasicSplitPaneUI.java -- Copyright (C) 2003, 2004, 2005, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.