|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tbee.swing.splitter.SplitterLayout
public class SplitterLayout
http://javadude.com/tools/tabsplitter/splitterlayout.html SplitterLayout is a layout manager that will layout a container holding other components and SplitterBars. Usage: lContainer.setLayout(new SplitterLayout(SplitterLayout.VERTICAL)); lContainer.add("1", ...); // "1" is a weigth JSplitterBar b1 = new JSplitterBar(); lContainer.add(b1); ... lContainer.add(..., SplitterLayout.PREFERRED); // use the components preferred size in the initial layout ... JSplitterBar can contain components themselves, which can contain splitterbars again: JSplitterBar b2 = new JSplitterBar(); b2.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL)); b2.add("5", new JSplitterSpace()); b2.add(new JSplitterBar()); b2.add("10", new JLabel("Status")); b2.add(new JSplitterBar()); b2.add("40", new JTextField("Enter your name")); lContainer.add(b2);
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:
JSplitterBar,
JSplitterSpace,
Serialized Form| Field Summary | |
|---|---|
static JSplitterBar |
dragee
|
static int |
HORIZONTAL
Aligns components horizontally -- SplitterBars will move left-right |
static java.lang.Integer |
PREFERRED
|
static int |
VERTICAL
Aligns components vertically -- SplitterBars will move up/down |
| Constructor Summary | |
|---|---|
SplitterLayout()
Create a new SplitterLayout -- default orientation is VERTICAL |
|
SplitterLayout(int orientation)
Create a new SplitterLayout |
|
| Method Summary | |
|---|---|
void |
addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
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 |
determineLayoutSize(java.awt.Container target,
boolean getPrefSize)
Determine the size of this layout |
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()
Gets the orientation property (int) value. |
void |
invalidateLayout(java.awt.Container target)
Does not have any effect (overridden to null the effect) |
void |
layoutContainer(java.awt.Container target)
Lays out the components in the specified container by telling then what their size will be |
static void |
main(java.lang.String[] args)
|
java.awt.Dimension |
maximumLayoutSize(java.awt.Container target)
Determines the maximum amount of space that could be used when laying out the components in the specified container. |
java.awt.Dimension |
minimumLayoutSize(java.awt.Container target)
Determines the minimum amount of room requested for the layout of components contained in the specified container. |
java.awt.Dimension |
preferredLayoutSize(java.awt.Container target)
Determines the preferred amount of room requested for the layout of components contained in the specified container. |
void |
removeLayoutComponent(java.awt.Component comp)
Removes a component from the layout. |
void |
setOrientation(int orientation)
Sets the orientation property (int) value. |
void |
swapOrientation(java.awt.Container container)
|
java.lang.String |
toString()
Returns a String representation of the Layout |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int VERTICAL
public static final int HORIZONTAL
public static JSplitterBar dragee
public static java.lang.Integer PREFERRED
| Constructor Detail |
|---|
public SplitterLayout()
public SplitterLayout(int orientation)
orientation - VERTICAL or HORIZONTAL| Method Detail |
|---|
public final void addLayoutComponent(java.awt.Component comp,
java.lang.Object constraints)
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 determineLayoutSize(java.awt.Container target,
boolean getPrefSize)
target - getPrefSize -
public final float getLayoutAlignmentX(java.awt.Container parent)
getLayoutAlignmentX in interface java.awt.LayoutManager2public final float getLayoutAlignmentY(java.awt.Container parent)
getLayoutAlignmentY in interface java.awt.LayoutManager2public int getOrientation()
setOrientation(int)public final void invalidateLayout(java.awt.Container target)
invalidateLayout in interface java.awt.LayoutManager2public final void layoutContainer(java.awt.Container target)
layoutContainer in interface java.awt.LayoutManagerpublic final java.awt.Dimension maximumLayoutSize(java.awt.Container target)
maximumLayoutSize in interface java.awt.LayoutManager2-- - the container being laid outpublic final java.awt.Dimension minimumLayoutSize(java.awt.Container target)
minimumLayoutSize in interface java.awt.LayoutManagertarget - --
the Container being laid outpublic final java.awt.Dimension preferredLayoutSize(java.awt.Container target)
preferredLayoutSize in interface java.awt.LayoutManagertarget - the Container being laid outpublic final void removeLayoutComponent(java.awt.Component comp)
removeLayoutComponent in interface java.awt.LayoutManagerpublic void setOrientation(int orientation)
orientation - The new value for the property.getOrientation()public void swapOrientation(java.awt.Container container)
public final java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||