Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class Container  view Container download Container.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
All Implemented Interfaces:
java.awt.image.ImageObserver, MenuContainer, java.io.Serializable
Direct Known Subclasses:
Panel, ScrollPane, Window

public class Container
extends Component

A generic window toolkit object that acts as a container for other objects. Components are tracked in a list, and new elements are at the end of the list or bottom of the stacking order.

Since:
1.0

Nested Class Summary
protected  class Container.AccessibleAWTContainer
          This class provides accessibility support for subclasses of container.
(package private) static class Container.GfxPaintAllVisitor
           
(package private) static class Container.GfxPaintVisitor
           
(package private) static class Container.GfxPrintAllVisitor
           
(package private) static class Container.GfxPrintVisitor
           
(package private) static class Container.GfxVisitor
           
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener
 
Field Summary
private  boolean backCleared
          Keeps track if the Container was cleared during a paint/update.
(package private)  Component[] component
           
(package private)  java.awt.event.ContainerListener containerListener
           
(package private)  int containerSerializedDataVersion
           
(package private)  boolean focusCycleRoot
           
(package private)  java.util.Set[] focusTraversalKeys
          The focus traversal keys, if not inherited from the parent or default keyboard manager.
private  FocusTraversalPolicy focusTraversalPolicy
          The focus traversal policy that determines how focus is transferred between this Container and its children.
(package private)  LayoutManager layoutMgr
           
(package private)  Dimension maxSize
           
(package private)  int ncomponents
           
private static long serialVersionUID
          Compatible with JDK 1.0+.
 
Fields inherited from class java.awt.Component
accessibleContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, changeSupport, componentListener, componentSerializedDataVersion, cursor, dropTarget, enabled, eventMask, focusable, focusListener, focusTraversalKeysEnabled, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyListener, ignoreRepaint, inputMethodListener, isFocusTraversableOverridden, isPacked, keyListener, LEFT_ALIGNMENT, locale, minSize, mouseListener, mouseMotionListener, mouseWheelListener, name, nameExplicitlySet, newEventsOnly, orientation, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, TOP_ALIGNMENT, treeLock, valid, visible, width, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Container()
          Default constructor for subclasses.
 
Method Summary
 Component add(Component comp)
          Adds the specified component to this container at the end of the component list.
 Component add(Component comp, int index)
          Adds the specified component to this container at the specified index in the component list.
 void add(Component comp, java.lang.Object constraints)
          Adds the specified component to this container at the end of the component list.
 void add(Component comp, java.lang.Object constraints, int index)
          Adds the specified component to this container at the specified index in the component list.
 Component add(java.lang.String name, Component comp)
          Adds the specified component to the container at the end of the component list.
 void addContainerListener(java.awt.event.ContainerListener listener)
          Adds the specified container listener to this object's list of container listeners.
protected  void addImpl(Component comp, java.lang.Object constraints, int index)
          This method is called by all the add() methods to perform the actual adding of the component.
 void addNotify()
          Called when this container is added to another container to inform it to create its peer.
private  void addNotifyContainerChildren()
           
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds the specified property listener to this component.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds the specified property listener to this component.
 void applyComponentOrientation(ComponentOrientation orientation)
          Sets the ComponentOrientation property of this container and all components contained within it.
 boolean areFocusTraversalKeysSet(int id)
          Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container.
 int countComponents()
          Deprecated. use getComponentCount() 55 instead
 void deliverEvent(Event e)
          Deprecated. use Component.dispatchEvent(AWTEvent) 55 instead
(package private)  void dispatchEventImpl(AWTEvent e)
          Implementation of dispatchEvent.
 void doLayout()
          Layout the components in this container.
(package private)  boolean eventTypeEnabled(int eventId)
          Tests if this container has an interest in the given event id.
 Component findComponentAt(int x, int y)
          Locates the visible child component that contains the specified position.
 Component findComponentAt(Point p)
          Locates the visible child component that contains the specified position.
(package private)  Component findNextFocusComponent(Component child)
          This method is used to implement transferFocus().
 float getAlignmentX()
          Returns the preferred alignment along the X axis.
 float getAlignmentY()
          Returns the preferred alignment along the Y axis.
 Component getComponent(int n)
          Returns the component at the specified index.
 Component getComponentAt(int x, int y)
          Returns the component located at the specified point.
 Component getComponentAt(Point p)
          Returns the component located at the specified point.
 int getComponentCount()
          Returns the number of components in this container.
 Component[] getComponents()
          Returns an array of the components in this container.
 int getComponentZOrder(Component comp)
          Returns the Z ordering index of comp.
 java.awt.event.ContainerListener[] getContainerListeners()
           
 java.util.Set getFocusTraversalKeys(int id)
          Returns the Set of focus traversal keys for a given traversal operation for this Container.
 FocusTraversalPolicy getFocusTraversalPolicy()
          Return the focus traversal policy that determines the focus traversal order for this Container's children.
 Insets getInsets()
          Returns the insets for this container, which is the space used for borders, the margin, etc.
 LayoutManager getLayout()
          Returns the current layout manager for this container.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns all registered java.util.EventListeners of the given listenerType.
 Dimension getMaximumSize()
          Returns the maximum size of this container.
 Dimension getMinimumSize()
          Returns the minimum size of this container.
 Dimension getPreferredSize()
          Returns the preferred size of this container.
 Insets insets()
          Deprecated. use getInsets() 55 instead
 void invalidate()
          Invalidates this container to indicate that it (and all parent containers) need to be laid out.
(package private)  void invalidateTree()
          Recursively invalidates the container tree.
 boolean isAncestorOf(Component comp)
          Tests whether or not the specified component is contained within this components subtree.
 boolean isFocusCycleRoot()
          Check whether this Container is a focus cycle root.
 boolean isFocusCycleRoot(Container c)
          Check whether the given Container is the focus cycle root of this Container's focus traversal cycle.
 boolean isFocusTraversalPolicySet()
          Check whether this Container's focus traversal policy has been explicitly set.
 void layout()
          Deprecated. use doLayout() 55 instead
 void list(java.io.PrintStream out, int indent)
          Writes a listing of this container to the specified stream starting at the specified indentation point.
 void list(java.io.PrintWriter out, int indent)
          Writes a listing of this container to the specified stream starting at the specified indentation point.
 Component locate(int x, int y)
          Deprecated. use getComponentAt(int, int) 55 instead
 Dimension minimumSize()
          Deprecated. use getMinimumSize() 55 instead
 void paint(Graphics g)
          Paints this container.
 void paintComponents(Graphics g)
          Paints all of the components in this container.
protected  java.lang.String paramString()
          Returns a string representing the state of this container for debugging purposes.
 Dimension preferredSize()
          Deprecated. use getPreferredSize() 55 instead
 void print(Graphics g)
          Prints this container.
 void printComponents(Graphics g)
          Prints all of the components in this container.
protected  void processContainerEvent(java.awt.event.ContainerEvent e)
          Called when a container event occurs if container events are enabled.
protected  void processEvent(AWTEvent e)
          Processes the specified event.
private  void readObject(java.io.ObjectInputStream s)
          Deserialize this Container: Read from the stream the default serializable fields. Read a list of serializable ContainerListeners as optional data.
 void remove(Component comp)
          Removes the specified component from this container.
 void remove(int index)
          Removes the component at the specified index from this container.
 void removeAll()
          Removes all components from this container.
 void removeContainerListener(java.awt.event.ContainerListener listener)
          Removes the specified container listener from this object's list of container listeners.
 void removeNotify()
          Called when this container is removed from its parent container to inform it to destroy its peer.
 void setComponentZOrder(Component comp, int index)
          Sets the Z ordering for the component comp to index.
 void setFocusCycleRoot(boolean focusCycleRoot)
          Set whether or not this Container is the root of a focus traversal cycle.
 void setFocusTraversalKeys(int id, java.util.Set keystrokes)
          Sets the focus traversal keys for a given traversal operation for this Container.
 void setFocusTraversalPolicy(FocusTraversalPolicy policy)
          If this Container is a focus cycle root, set the focus traversal policy that determines the focus traversal order for its children.
 void setFont(Font f)
          Sets the font for this component to the specified font.
 void setLayout(LayoutManager mgr)
          Sets the layout manager for this container to the specified layout manager.
 void transferFocusDownCycle()
          Transfer focus down one focus traversal cycle.
 void update(Graphics g)
          Updates this container.
 void validate()
          Re-lays out the components in this container.
protected  void validateTree()
          Recursively validates the container tree, recomputing any invalid layouts.
private  void visitChild(Graphics gfx, Container.GfxVisitor visitor, Component comp)
          Perform a graphics operation on a child.
private  void visitChildren(Graphics gfx, Container.GfxVisitor visitor, boolean lightweightOnly)
          Perform a graphics operation on the children of this container.
private  void writeObject(java.io.ObjectOutputStream s)
          Serialize this Container: Write to the stream the default serializable fields. Write the list of serializable ContainerListeners as optional data. Write this Container's FocusTraversalPolicy as optional data.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, generateName, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getGraphicsConfigurationImpl, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setPeer, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, translateEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.0+.

See Also:
Constant Field Values

ncomponents

int ncomponents

component

Component[] component

layoutMgr

LayoutManager layoutMgr

maxSize

Dimension maxSize

backCleared

private boolean backCleared
Keeps track if the Container was cleared during a paint/update.


focusCycleRoot

boolean focusCycleRoot
Since:
1.4

containerSerializedDataVersion

int containerSerializedDataVersion

containerListener

transient java.awt.event.ContainerListener containerListener

focusTraversalPolicy

private FocusTraversalPolicy focusTraversalPolicy
The focus traversal policy that determines how focus is transferred between this Container and its children.


focusTraversalKeys

transient java.util.Set[] focusTraversalKeys
The focus traversal keys, if not inherited from the parent or default keyboard manager. These sets will contain only AWTKeyStrokes that represent press and release events to use as focus control.

Since:
1.4
See Also:
getFocusTraversalKeys(int) 55 , setFocusTraversalKeys(int, Set) 55
Constructor Detail

Container

public Container()
Default constructor for subclasses.

Method Detail

getComponentCount

public int getComponentCount()
Returns the number of components in this container.


countComponents

public int countComponents()
Deprecated. use getComponentCount() 55 instead

Returns the number of components in this container.


getComponent

public Component getComponent(int n)
Returns the component at the specified index.


getComponents

public Component[] getComponents()
Returns an array of the components in this container.


getInsets

public Insets getInsets()
Returns the insets for this container, which is the space used for borders, the margin, etc.


insets

public Insets insets()
Deprecated. use getInsets() 55 instead

Returns the insets for this container, which is the space used for borders, the margin, etc.


add

public Component add(Component comp)
Adds the specified component to this container at the end of the component list.


add

public Component add(java.lang.String name,
                     Component comp)
Adds the specified component to the container at the end of the component list. This method should not be used. Instead, use add(Component, Object).


add

public Component add(Component comp,
                     int index)
Adds the specified component to this container at the specified index in the component list.


add

public void add(Component comp,
                java.lang.Object constraints)
Adds the specified component to this container at the end of the component list. The layout manager will use the specified constraints when laying out this component.


add

public void add(Component comp,
                java.lang.Object constraints,
                int index)
Adds the specified component to this container at the specified index in the component list. The layout manager will use the specified constraints when layout out this component.


addImpl

protected void addImpl(Component comp,
                       java.lang.Object constraints,
                       int index)
This method is called by all the add() methods to perform the actual adding of the component. Subclasses who wish to perform their own processing when a component is added should override this method. Any subclass doing this must call the superclass version of this method in order to ensure proper functioning of the container.


remove

public void remove(int index)
Removes the component at the specified index from this container.


remove

public void remove(Component comp)
Removes the specified component from this container.


removeAll

public void removeAll()
Removes all components from this container.


getLayout

public LayoutManager getLayout()
Returns the current layout manager for this container.


setLayout

public void setLayout(LayoutManager mgr)
Sets the layout manager for this container to the specified layout manager.


doLayout

public void doLayout()
Layout the components in this container.

Overrides:
doLayout in class Component

layout

public void layout()
Deprecated. use doLayout() 55 instead

Layout the components in this container.

Overrides:
layout in class Component

invalidate

public void invalidate()
Invalidates this container to indicate that it (and all parent containers) need to be laid out.

Overrides:
invalidate in class Component

validate

public void validate()
Re-lays out the components in this container.

Overrides:
validate in class Component

invalidateTree

void invalidateTree()
Recursively invalidates the container tree.


validateTree

protected void validateTree()
Recursively validates the container tree, recomputing any invalid layouts.


setFont

public void setFont(Font f)
Description copied from class: Component
Sets the font for this component to the specified font. This is a bound property.

Overrides:
setFont in class Component

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of this container.

Overrides:
getPreferredSize in class Component

preferredSize

public Dimension preferredSize()
Deprecated. use getPreferredSize() 55 instead

Returns the preferred size of this container.

Overrides:
preferredSize in class Component

getMinimumSize

public Dimension getMinimumSize()
Returns the minimum size of this container.

Overrides:
getMinimumSize in class Component

minimumSize

public Dimension minimumSize()
Deprecated. use getMinimumSize() 55 instead

Returns the minimum size of this container.

Overrides:
minimumSize in class Component

getMaximumSize

public Dimension getMaximumSize()
Returns the maximum size of this container.

Overrides:
getMaximumSize in class Component

getAlignmentX

public float getAlignmentX()
Returns the preferred alignment along the X axis. This is a value between 0 and 1 where 0 represents alignment flush left and 1 means alignment flush right, and 0.5 means centered.

Overrides:
getAlignmentX in class Component

getAlignmentY

public float getAlignmentY()
Returns the preferred alignment along the Y axis. This is a value between 0 and 1 where 0 represents alignment flush top and 1 means alignment flush bottom, and 0.5 means centered.

Overrides:
getAlignmentY in class Component

paint

public void paint(Graphics g)
Paints this container. The implementation of this method in this class forwards to any lightweight components in this container. If this method is subclassed, this method should still be invoked as a superclass method so that lightweight components are properly drawn.

Overrides:
paint in class Component

update

public void update(Graphics g)
Updates this container. The implementation of this method in this class forwards to any lightweight components in this container. If this method is subclassed, this method should still be invoked as a superclass method so that lightweight components are properly drawn.

Overrides:
update in class Component

print

public void print(Graphics g)
Prints this container. The implementation of this method in this class forwards to any lightweight components in this container. If this method is subclassed, this method should still be invoked as a superclass method so that lightweight components are properly drawn.

Overrides:
print in class Component

paintComponents

public void paintComponents(Graphics g)
Paints all of the components in this container.


printComponents

public void printComponents(Graphics g)
Prints all of the components in this container.


addContainerListener

public void addContainerListener(java.awt.event.ContainerListener listener)
Adds the specified container listener to this object's list of container listeners.


removeContainerListener

public void removeContainerListener(java.awt.event.ContainerListener listener)
Removes the specified container listener from this object's list of container listeners.


getContainerListeners

public java.awt.event.ContainerListener[] getContainerListeners()
Since:
1.4

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns all registered java.util.EventListeners of the given listenerType.

Overrides:
getListeners in class Component
Since:
1.3

processEvent

protected void processEvent(AWTEvent e)
Processes the specified event. This method calls processContainerEvent() if this method is a ContainerEvent, otherwise it calls the superclass method.

Overrides:
processEvent in class Component

processContainerEvent

protected void processContainerEvent(java.awt.event.ContainerEvent e)
Called when a container event occurs if container events are enabled. This method calls any registered listeners.


deliverEvent

public void deliverEvent(Event e)
Deprecated. use Component.dispatchEvent(AWTEvent) 55 instead

AWT 1.0 event processor.

Overrides:
deliverEvent in class Component

getComponentAt

public Component getComponentAt(int x,
                                int y)
Returns the component located at the specified point. This is done by checking whether or not a child component claims to contain this point. The first child component that does is returned. If no child component claims the point, the container itself is returned, unless the point does not exist within this container, in which case null is returned. When components overlap, the first component is returned. The component that is closest to (x, y), containing that location, is returned. Heavyweight components take precedence of lightweight components. This function does not ignore invisible components. If there is an invisible component at (x,y), it will be returned.

Overrides:
getComponentAt in class Component

locate

public Component locate(int x,
                        int y)
Deprecated. use getComponentAt(int, int) 55 instead

Returns the component located at the specified point. This is done by checking whether or not a child component claims to contain this point. The first child component that does is returned. If no child component claims the point, the container itself is returned, unless the point does not exist within this container, in which case null is returned. When components overlap, the first component is returned. The component that is closest to (x, y), containing that location, is returned. Heavyweight components take precedence of lightweight components. This function does not ignore invisible components. If there is an invisible component at (x,y), it will be returned.

Overrides:
locate in class Component

getComponentAt

public Component getComponentAt(Point p)
Returns the component located at the specified point. This is done by checking whether or not a child component claims to contain this point. The first child component that does is returned. If no child component claims the point, the container itself is returned, unless the point does not exist within this container, in which case null is returned. The top-most child component is returned in the case where components overlap. This is determined by finding the component closest to (x,y) and contains that location. Heavyweight components take precedence of lightweight components. This function does not ignore invisible components. If there is an invisible component at (x,y), it will be returned.

Overrides:
getComponentAt in class Component

findComponentAt

public Component findComponentAt(int x,
                                 int y)
Locates the visible child component that contains the specified position. The top-most child component is returned in the case where there is overlap in the components. If the containing child component is a Container, this method will continue searching for the deepest nested child component. Components which are not visible are ignored during the search. findComponentAt differs from getComponentAt, because it recursively searches a Container's children.


findComponentAt

public Component findComponentAt(Point p)
Locates the visible child component that contains the specified position. The top-most child component is returned in the case where there is overlap in the components. If the containing child component is a Container, this method will continue searching for the deepest nested child component. Components which are not visible are ignored during the search. findComponentAt differs from getComponentAt, because it recursively searches a Container's children.


addNotify

public void addNotify()
Called when this container is added to another container to inform it to create its peer. Peers for any child components will also be created.

Overrides:
addNotify in class Component

removeNotify

public void removeNotify()
Called when this container is removed from its parent container to inform it to destroy its peer. This causes the peers of all child component to be destroyed as well.

Overrides:
removeNotify in class Component

isAncestorOf

public boolean isAncestorOf(Component comp)
Tests whether or not the specified component is contained within this components subtree.


paramString

protected java.lang.String paramString()
Returns a string representing the state of this container for debugging purposes.

Overrides:
paramString in class Component

list

public void list(java.io.PrintStream out,
                 int indent)
Writes a listing of this container to the specified stream starting at the specified indentation point.

Overrides:
list in class Component

list

public void list(java.io.PrintWriter out,
                 int indent)
Writes a listing of this container to the specified stream starting at the specified indentation point.

Overrides:
list in class Component

setFocusTraversalKeys

public void setFocusTraversalKeys(int id,
                                  java.util.Set keystrokes)
Sets the focus traversal keys for a given traversal operation for this Container.

Overrides:
setFocusTraversalKeys in class Component
Since:
1.4

getFocusTraversalKeys

public java.util.Set getFocusTraversalKeys(int id)
Returns the Set of focus traversal keys for a given traversal operation for this Container.

Overrides:
getFocusTraversalKeys in class Component
Since:
1.4

areFocusTraversalKeysSet

public boolean areFocusTraversalKeysSet(int id)
Returns whether the Set of focus traversal keys for the given focus traversal operation has been explicitly defined for this Container. If this method returns false, this Container is inheriting the Set from an ancestor, or from the current KeyboardFocusManager.

Overrides:
areFocusTraversalKeysSet in class Component
Since:
1.4

isFocusCycleRoot

public boolean isFocusCycleRoot(Container c)
Check whether the given Container is the focus cycle root of this Container's focus traversal cycle. If this Container is a focus cycle root itself, then it will be in two different focus cycles -- it's own, and that of its ancestor focus cycle root's. In that case, if c is either of those containers, this method will return true.

Overrides:
isFocusCycleRoot in class Component
Since:
1.4

setFocusTraversalPolicy

public void setFocusTraversalPolicy(FocusTraversalPolicy policy)
If this Container is a focus cycle root, set the focus traversal policy that determines the focus traversal order for its children. If non-null, this policy will be inherited by all inferior focus cycle roots. If policy is null, this Container will inherit its policy from the closest ancestor focus cycle root that's had its policy set.

Since:
1.4

getFocusTraversalPolicy

public FocusTraversalPolicy getFocusTraversalPolicy()
Return the focus traversal policy that determines the focus traversal order for this Container's children. This method returns null if this Container is not a focus cycle root. If the focus traversal policy has not been set explicitly, then this method will return an ancestor focus cycle root's policy instead.

Since:
1.4

isFocusTraversalPolicySet

public boolean isFocusTraversalPolicySet()
Check whether this Container's focus traversal policy has been explicitly set. If it has not, then this Container will inherit its focus traversal policy from one of its ancestor focus cycle roots.


setFocusCycleRoot

public void setFocusCycleRoot(boolean focusCycleRoot)
Set whether or not this Container is the root of a focus traversal cycle. This Container's focus traversal policy determines the order of focus traversal. Some policies prevent the focus from being transferred between two traversal cycles until an up or down traversal operation is performed. In that case, normal traversal (not up or down) is limited to this Container and all of this Container's descendents that are not descendents of inferior focus cycle roots. In the default case however, ContainerOrderFocusTraversalPolicy is in effect, and it supports implicit down-cycle traversal operations.

Since:
1.4

isFocusCycleRoot

public boolean isFocusCycleRoot()
Check whether this Container is a focus cycle root.

Since:
1.4

transferFocusDownCycle

public void transferFocusDownCycle()
Transfer focus down one focus traversal cycle. If this Container is a focus cycle root, then its default component becomes the focus owner, and this Container becomes the current focus cycle root. No traversal will occur if this Container is not a focus cycle root.

Since:
1.4

applyComponentOrientation

public void applyComponentOrientation(ComponentOrientation orientation)
Sets the ComponentOrientation property of this container and all components contained within it.

Overrides:
applyComponentOrientation in class Component
Since:
1.4

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from class: Component
Adds the specified property listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice. The property listener ignores inherited properties. Recognized properties include:
  • the font ("font")
  • the background color ("background")
  • the foreground color ("foreground")
  • the focusability ("focusable")
  • the focus key traversal enabled state ("focusTraversalKeysEnabled")
  • the set of forward traversal keys ("forwardFocusTraversalKeys")
  • the set of backward traversal keys ("backwardFocusTraversalKeys")
  • the set of up-cycle traversal keys ("upCycleFocusTraversalKeys")

Overrides:
addPropertyChangeListener in class Component

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Description copied from class: Component
Adds the specified property listener to this component. This is harmless if the listener is null, but if the listener has already been registered, it will now be registered twice. The property listener ignores inherited properties. The listener is keyed to a single property. Recognized properties include:
  • the font ("font")
  • the background color ("background")
  • the foreground color ("foreground")
  • the focusability ("focusable")
  • the focus key traversal enabled state ("focusTraversalKeysEnabled")
  • the set of forward traversal keys ("forwardFocusTraversalKeys")
  • p *
  • the set of backward traversal keys ("backwardFocusTraversalKeys")
  • the set of up-cycle traversal keys ("upCycleFocusTraversalKeys")

Overrides:
addPropertyChangeListener in class Component

setComponentZOrder

public final void setComponentZOrder(Component comp,
                                     int index)
Sets the Z ordering for the component comp to index. Components with lower Z order paint above components with higher Z order.

Since:
1.5

getComponentZOrder

public final int getComponentZOrder(Component comp)
Returns the Z ordering index of comp. If comp is not a child component of this Container, this returns -1.

Since:
1.5

visitChildren

private void visitChildren(Graphics gfx,
                           Container.GfxVisitor visitor,
                           boolean lightweightOnly)
Perform a graphics operation on the children of this container. For each applicable child, the visitChild() method will be called to perform the graphics operation.


visitChild

private void visitChild(Graphics gfx,
                        Container.GfxVisitor visitor,
                        Component comp)
Perform a graphics operation on a child. A translated and clipped graphics object will be created, and the visit() method of the visitor will be called to perform the operation.


dispatchEventImpl

void dispatchEventImpl(AWTEvent e)
Description copied from class: Component
Implementation of dispatchEvent. Allows trusted package classes to dispatch additional events first. This implementation first translates e to an AWT 1.0 event and sends the result to Component.postEvent(java.awt.Event) 55 . If the AWT 1.0 event is not handled, and events of type e are enabled for this component, e is passed on to Component.processEvent(java.awt.AWTEvent) 55 .

Overrides:
dispatchEventImpl in class Component

eventTypeEnabled

boolean eventTypeEnabled(int eventId)
Tests if this container has an interest in the given event id.

Overrides:
eventTypeEnabled in class Component

findNextFocusComponent

Component findNextFocusComponent(Component child)
Description copied from class: Component
This method is used to implement transferFocus(). CHILD is the child making the request. This is overridden by Container; when called for an ordinary component there is no child and so we always return null. FIXME: is this still needed, in light of focus traversal policies?

Overrides:
findNextFocusComponent in class Component

addNotifyContainerChildren

private void addNotifyContainerChildren()

readObject

private void readObject(java.io.ObjectInputStream s)
                 throws java.lang.ClassNotFoundException,
                        java.io.IOException
Deserialize this Container:
  1. Read from the stream the default serializable fields.
  2. Read a list of serializable ContainerListeners as optional data. If the list is null, no listeners will be registered.
  3. Read this Container's FocusTraversalPolicy as optional data. If this is null, then this Container will use a DefaultFocusTraversalPolicy.


writeObject

private void writeObject(java.io.ObjectOutputStream s)
                  throws java.io.IOException
Serialize this Container:
  1. Write to the stream the default serializable fields.
  2. Write the list of serializable ContainerListeners as optional data.
  3. Write this Container's FocusTraversalPolicy as optional data.