public class SplitterLayout
extends java.lang.Object
implements java.awt.LayoutManager2, java.io.Serializable
Each component added to a container to be laid out using SplitterLayout must provide a String containing a "weight" for the component. This weight will be used to determine the initial spacing of all components being laid out. The weight numbers are arbitrary integers. The amount of space initially allocated for a component is
(wc / wt) * (size - insets - splitterSize)
where
If the container being laid out holds no SplitterBars, SplitterLayout acts like a relational-weight layout manager. All components are always laid out based on their proportionate weights.
If the container being laid out holds some SplitterBars, SplitterLayout will initially size all non JSplitterBar components based on their weights. Any succesive layouts are computed strictly on the locations of the SplitterBars.
SplitterLayout can be oriented Horizontally or Vertically. Any SpliterBars placed in the container will automatically be oriented.
If a JSplitterBar has been modified (adding components to it) you will need to add JSplitterSpace components to it. See JSplitterBar for more details.
Known Problems:
Modifier and Type | Field and Description |
---|---|
protected static DSplitterBar |
dragee |
private int |
fieldOrientation |
static int |
HORIZONTAL |
private int |
lastH |
private int |
lastW |
private boolean |
newComponentAdded |
private java.util.Hashtable<java.awt.Component,java.lang.Object> |
relations |
private static long |
serialVersionUID |
static int |
VERTICAL |
Constructor and Description |
---|
SplitterLayout() |
SplitterLayout(int orientation) |
Modifier and Type | Method and Description |
---|---|
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object cin)
Adds a component w/ constraints to the layout.
|
void |
addLayoutComponent(java.lang.String name,
java.awt.Component comp)
Adds a component w/ a String constraint to the layout.
|
java.awt.Dimension |
checkLayoutSize(java.awt.Container target,
boolean getPrefSize) |
float |
getLayoutAlignmentX(java.awt.Container parent)
Tells the caller that we prefer to be centered
|
float |
getLayoutAlignmentY(java.awt.Container parent)
Tells the caller that we prefer to be centered
|
int |
getOrientation() |
void |
invalidateLayout(java.awt.Container target)
Does not have any effect (overridden to null the effect)
|
void |
layoutContainer(java.awt.Container target) |
java.awt.Dimension |
maximumLayoutSize(java.awt.Container target) |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container target) |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container target) |
void |
removeLayoutComponent(java.awt.Component comp) |
void |
setOrientation(int orientation) |
void |
swapOrientation(java.awt.Container container) |
java.lang.String |
toString()
Returns a String representation of the Layout
|
private static final long serialVersionUID
public static final int VERTICAL
public static final int HORIZONTAL
protected static DSplitterBar dragee
private int lastW
private int lastH
private boolean newComponentAdded
private java.util.Hashtable<java.awt.Component,java.lang.Object> relations
private int fieldOrientation
public SplitterLayout()
public SplitterLayout(int orientation)
public final void addLayoutComponent(java.awt.Component comp, java.lang.Object cin)
addLayoutComponent
in interface java.awt.LayoutManager2
public final void addLayoutComponent(java.lang.String name, java.awt.Component comp)
addLayoutComponent
in interface java.awt.LayoutManager
public final java.awt.Dimension checkLayoutSize(java.awt.Container target, boolean getPrefSize)
public final float getLayoutAlignmentX(java.awt.Container parent)
getLayoutAlignmentX
in interface java.awt.LayoutManager2
public final float getLayoutAlignmentY(java.awt.Container parent)
getLayoutAlignmentY
in interface java.awt.LayoutManager2
public int getOrientation()
public final void invalidateLayout(java.awt.Container target)
invalidateLayout
in interface java.awt.LayoutManager2
public final void layoutContainer(java.awt.Container target)
layoutContainer
in interface java.awt.LayoutManager
public final java.awt.Dimension maximumLayoutSize(java.awt.Container target)
maximumLayoutSize
in interface java.awt.LayoutManager2
public final java.awt.Dimension minimumLayoutSize(java.awt.Container target)
minimumLayoutSize
in interface java.awt.LayoutManager
public final java.awt.Dimension preferredLayoutSize(java.awt.Container target)
preferredLayoutSize
in interface java.awt.LayoutManager
public final void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent
in interface java.awt.LayoutManager
public void setOrientation(int orientation)
public void swapOrientation(java.awt.Container container)
public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2013. All Rights Reserved.