class org.aswing.Container extends Component
Sub classes | ||||||||||||||||||||||||||||||||||||||||||||
![]() | AbstractColorChooserPanel, GridCellHolder, Divider, JTableHeader, AbstractTabbedPane, AssetPane, CellPane, JFrameTitleBar, JLayeredPane, JList, JMenuBar, JPanel, JPopupMenu, JRootPane, JScrollPane, JSplitPane, JTable, JToolBar, JToolTip, JTree, JViewport |
|
Container can contain many component to be his child, all children are in its bounds, and it moved, all children moved. It be removed from stage all children will be removed from stage.
It for component like DisplayObjectContainer
for DisplayObject
.
- There are two scope for
Container
children, One isComponent
children. The indices and numbers forinsert()
,getComponent()
,removeAt()
,getComponentCount()
is inComponent
children scope. - Another is normal
DisplayObject
children, The indices and numbers foraddChildAt()
,getChildAt()
,removeChildAt()
andnumChildren()
is in normalDisplayObject
children scope.
![]() | Show Events | Hide Events
|
Instance Fields
function append(com:Component, ?constraints:Dynamic = null): Void
On Component just can add to one Container.
So if the com has a parent, it will remove from its parent first, then add to
this container.
This method is as same as insert(-1, com, constraints)
.
com | the component to be added |
constraints | an object expressing layout contraints for this component |
See Also
- this.insert()
function appendAll(coms:Array<Dynamic>): Void
Adds one or more component to the container with null constraints
See Also
- this.append()
function getComponent(index:Int): Component
Gets the nth(index) component in this container. @throw RangeError if index out of container children bounds
n | the index of the component to get. |
returns | the nth component in this container. returned null if the index if out of bounds. |
See Also
- this.getComponentCount()
function getComponentCount(): Int
Gets the number of components in this container.
returns | the number of components in this container. |
See Also
- this.getComponent()
function getFocusTraversalPolicy(): FocusTraversalPolicy
Returns the focus traversal policy of this container, it will return its parent's
focus traversal policy if its self is null. If no focus traversal policy is found,
it will return a default focus traversal policy.
(FocusManager.getCurrentManager().getDefaultFocusTraversalPolicy()
).
returns | the focus traversal policy |
function getIndex(com:Component): Int
Returns the index of the child component in this container.
returns | the index of the specified child component. |
See Also
- this.getComponent()
function insert(i:Int, com:Component, ?constraints:Dynamic = null): Void
Add component to spesified index. So if the com has a parent, it will remove from its parent first, then add to this container.
i | index the position at which to insert the component, or less than 0 value to append the component to the end |
com | the component to be added |
constraints | an object expressing layout contraints for this component |
See Also
- Component.removeFromContainer()
- this.append()
function insertAll(index:Int, coms:Array<Dynamic>): Void
Insets one or more component to the container with null constraints at specified starting index.
See Also
- this.insert()
function invalidate(): Void
Invalidates the container. The container and all parents above it are marked as needing to be laid out. This method can be called often, so it needs to execute quickly.
See Also
- this.validate()
- this.doLayout()
- org.aswing.LayoutManager
function isAncestorOf(c:Component): Bool
Checks if the component is contained in the component hierarchy of this container.
c | the component |
returns |
|
function reAppendChildren(): Void
Removes all children and then append them with their constraints.
See Also
function remove(com:Component): Component
Remove the specified child component.
returns | the component just removed, null if the component is not in this container. |
function removeAt(i:Int): Component
Remove the specified index child component.
i | the index of component. |
returns | the component just removed. or null there is not component at this position. |
function removeChild(child:DisplayObject): DisplayObject
function removeChildAt(index:Int): DisplayObject
function setFocusTraversalPolicy(ftp:FocusTraversalPolicy): Void
Sets the focus traversal policy to this container, or sets null to make this container use its parent's focus traversal policy. (By default, it is null)
ftp | the focus traversal policy, or null. |
Validates this container and all of its subcomponents.
The validate
method is used to cause a container
to lay out its subcomponents again. It should be invoked when
this container's subcomponents are modified (added to or
removed from the container, or layout-related information
changed) after the container has been displayed.
See Also
- this.append()
- Component.invalidate()
- org.aswing.Component.revalidate()