Package com.ms.ui |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class UISplitLayout extends UILayoutManager { // Fields public final static int HORIZONTAL; // Constructors public UISplitLayout(); public UISplitLayout(int flags); public UISplitLayout(int flags, int pos); // Methods public Component getComponent(String name); public int getPos(); public void setPos(int pos); public void addLayoutComponent(String name, Component comp); public void removeLayoutComponent(Component comp); public void layoutContainer(Container target); public Dimension minimumLayoutSize(Container target); public Dimension preferredLayoutSize(Container target); public Component navigate(Container cont, Component comp, int dir, boolean keyable); }
A class that implements a split layout manager; used by UISplitViewer to manage a split viewer control. UISplitLayout defines the following three layout components.
Layout Name | Description |
NW | Identifies the component in the North pane if the split is horizontal or the West pane if the split is vertical. |
SE | Identifies the component in the South pane if the split is horizontal or the East pane if the split is vertical. |
Splitter | The splitter component positioned between the NW and SE panes. |
UISplitLayout manages the split position for the split viewer. A negative split position means the height or width of the NW component is a percentage of the split viewer's total height or width. A positive split position specifies the height or width as an absolute value in pixels. You can initially set the split position in the constructor (the default value is -50), as shown in the following example.
// Specify a horizontal split with a split position of 150. // This means the NW component will be 150 pixels in height. // The remainder of the split viewer's content area will be // filled with the splitter component and the SE component. UISplitLayout sl = new UISplitLayout(UISplitLayout.HORIZONTAL, 150);
UISplitLayout also defines the getPos and setPos methods to retrieve and set the split position. Note that the split position cannot be less than -100.
public UISplitLayout();Creates a split layout manager.
Remarks:
By default, the layout manager uses a vertical split with an initial split position of -50. For more information about split positions, see the UISplitLayout overview.
public UISplitLayout(int flags);Creates a split layout manager with the specified layout flags.
Parameter Description flags The style flags for the layout. Specify HORIZONTAL for a horizontal split, or 0 for a vertical split. Remarks:
By default, the initial split position is defined to be -50. If any undefined flags are specified, an IllegalArgumentException is thrown.
For more information about split positions, see the UISplitLayout overview.
public UISplitLayout(int flags, int pos);Creates a split layout manager with the specified layout flags and split position.
Parameter Description flags Specify HORIZONTAL for a horizontal split, or 0 for a vertical split. pos The initial split position. A negative value means the height or width of the NW component is a percentage of the split viewer's total height or width. A positive split position specifies the height or width as an absolute value in pixels. For more information, see the UISplitLayout overview. Remarks:
If any undefined flags are specified, or if the split position is less than -100, an IllegalArgumentException is thrown.
public void addLayoutComponent(String name, Component comp);Adds or replaces the specified layout component with the given component.
Return Value:
No return value.
Parameter Description name The layout name identifying the component to be added or replaced. Specify "NW" for the component in the North or West pane, "SE" for the component in the South or East pane, or "Splitter" for the splitter control between the panes. comp The new component to use. Remarks:
Note that the name parameter is not case-sensitive. If an undefined name is specified, an IllegalArgumentException is thrown.
public Component getComponent(String name);Retrieves the component that is identified by name.
Return Value:
Returns the specified component.
Parameter Description name The layout name identifying the component to be retrieved. Specify "NW" for the component in the North or West pane, "SE" for the component in the South or East pane, or "Splitter" for the splitter control between the panes. Remarks:
Note that the name parameter is not case-sensitive. If an undefined name is specified, an IllegalArgumentException is thrown.
public int getPos();Retrieves the current split position.
Return Value:
Returns the split position used by the split layout manager.
Remarks:
For more information about split positions, see the UISplitLayout overview.
public void layoutContainer(Container target);Lays out the components in the specified container.
Return Value:
No return value.
Parameter Description target The container of the components being laid out.
public Dimension minimumLayoutSize(Container target);Determines the minimum dimensions (in pixels) needed to lay out the components in the specified container.
Return Value:
Returns a Dimension object containing the minimum size.
Parameter Description target The container of the components to be laid out. Remarks:
The minimum layout size is determined from the minimum size of each component in the container.
public Component navigate(Container cont, Component comp, int dir, boolean keyable);Navigates to another component from the specified component in the given direction.
Return Value:
Always returns null, indicating no component can be navigated to.
Parameter Description cont The container where the navigation is occurring. comp The component to navigate from. dir The direction to navigate. keyable If true, non-keyable components will be ignored during the navigation; otherwise, all components can be navigated to.
public Dimension preferredLayoutSize(Container target);Determines the preferred dimensions (in pixels) for laying out the components in the specified container.
Return Value:
Returns a Dimension object containing the preferred size.
Parameter Description target The container of the components to be laid out. Remarks:
The preferred layout size is determined from the preferred size of each component in the container.
public void removeLayoutComponent(Component comp);Removes the specified component.
Return Value:
No return value.
Parameter Description comp The component to be removed.
public void setPos(int pos);Sets the current split position.
Parameter Description pos The new split position. For more information, see the UISplitLayout overview. Remarks:
This method invalidates both layout panes. If the split position is less than -100, an IllegalArgumentException is thrown.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.