| GNU Classpath (0.97.2) | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectjava.awt.Componentjava.awt.ContainerNested Class Summary | |
protected class |
|
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy | |
Field Summary |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH | |
Constructor Summary | |
| |
Method Summary | |
Component | |
Component | |
void | |
void | |
Component | |
void |
|
protected void | |
void |
|
void |
|
void |
|
void |
|
boolean |
|
int |
|
void |
|
void |
|
|
|
Component |
|
Component |
|
float |
|
float |
|
Component |
|
Component |
|
Component |
|
int |
|
int |
|
Component[] |
|
ContainerListener[] | |
Set |
|
FocusTraversalPolicy |
|
Insets |
|
LayoutManager |
|
Dimension |
|
Dimension |
|
Point |
|
Dimension |
|
Insets |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
Component |
|
Dimension |
|
void | |
void |
|
protected String |
|
Dimension |
|
void | |
void |
|
protected void |
|
protected void |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
void |
|
void |
|
void | |
void |
|
protected void |
|
Methods inherited from class java.lang.Object | |
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait | |
public Component add(Component comp)
Adds the specified component to this container at the end of the component list.
- Parameters:
comp- The component to add to the container.
- Returns:
- The same component that was added.
public Component add(Component comp, int index)
Adds the specified component to this container at the specified index in the component list.
- Parameters:
comp- The component to be added.index- The index in the component list to insert this child at, or -1 to add at the end of the list.
- Returns:
- The same component that was added.
- Throws:
ArrayIndexOutOfBoundsException- If the specified index is invalid.
public void add(Component comp, 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.
- Parameters:
comp- The component to be added to this container.constraints- The layout constraints for this component.
public void add(Component comp, 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.
- Parameters:
comp- The component to be added.constraints- The layout constraints for this component.index- The index in the component list to insert this child at, or -1 to add at the end of the list.
- Throws:
ArrayIndexOutOfBoundsException- If the specified index is invalid.
public Component add(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, useadd(Component, Object).
- Parameters:
name- The name of the component to be added.comp- The component to be added.
- Returns:
- The same component that was added.
- See Also:
add(Component,Object)
public void addContainerListener(ContainerListener listener)
Adds the specified container listener to this object's list of container listeners.
- Parameters:
listener- The listener to add.
protected void addImpl(Component comp, Object constraints, int index)
This method is called by all theadd()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.
- Parameters:
comp- The component to be added.constraints- The layout constraints for this component, ornullif there are no constraints.index- The index in the component list to insert this child at, or -1 to add at the end of the list.
- Throws:
ArrayIndexOutOfBoundsException- If the specified index is invalid.
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.
public void addPropertyChangeListener(PropertyChangeListener listener)
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 interface Component
- Parameters:
listener- the new listener to add
- Since:
- 1.1
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
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")- the set of backward traversal keys (
"backwardFocusTraversalKeys")- the set of up-cycle traversal keys (
"upCycleFocusTraversalKeys")
- Overrides:
- addPropertyChangeListener in interface Component
- Parameters:
propertyName- the property name to filter onlistener- the new listener to add
- Since:
- 1.1
public void applyComponentOrientation(ComponentOrientation orientation)
Sets the ComponentOrientation property of this container and all components contained within it.
- Overrides:
- applyComponentOrientation in interface Component
- Throws:
NullPointerException- If orientation is null
- Since:
- 1.4
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 interface Component
- Throws:
IllegalArgumentException- If id is not one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS.
- Since:
- 1.4
public int countComponents()
Deprecated. use
getComponentCount()insteadReturns the number of components in this container.
- Returns:
- The number of components in this container.
public void deliverEvent(Event e)
Deprecated. use
dispatchEvent(AWTEvent)insteadAWT 1.0 event processor.
- Overrides:
- deliverEvent in interface Component
- Parameters:
e- The event that occurred.
publicextends EventListener> T[] getListeners(Class listenerType)
Returns all registeredEventListeners of the givenlistenerType.
- Overrides:
- extends EventListener> T[] getListeners in interface Component
- Parameters:
listenerType- the class of listeners to filter (nullnot permitted).
- Returns:
- An array of registered listeners.
- Throws:
ClassCastException- iflistenerTypedoes not implement theEventListenerinterface.NullPointerException- iflistenerTypeisnull.
- Since:
- 1.3
- See Also:
getContainerListeners()
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.
- Parameters:
x- - x coordinatey- - y coordinate
- Returns:
- null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned.
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.
- Parameters:
p- - the component's location
- Returns:
- null if the component does not contain the position. If there is no child component at the requested point and the point is within the bounds of the container the container itself is returned.
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 interface Component
- Returns:
- The preferred alignment along the X axis.
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 interface Component
- Returns:
- The preferred alignment along the Y axis.
public Component getComponent(int n)
Returns the component at the specified index.
- Parameters:
n- The index of the component to retrieve.
- Returns:
- The requested component.
- Throws:
ArrayIndexOutOfBoundsException- If the specified index is invalid
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 casenullis 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 interface Component
- Parameters:
x- The X coordinate of the point.y- The Y coordinate of the point.
- Returns:
- The component containing the specified point, or
nullif there is no such point.
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 casenullis 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 interface Component
- Parameters:
p- The point to return the component at.
- Returns:
- The component containing the specified point, or
nullif there is no such point.
public int getComponentCount()
Returns the number of components in this container.
- Returns:
- The number of components in this container.
public final int getComponentZOrder(Component comp)
Returns the Z ordering index ofcomp. Ifcompis not a child component of this Container, this returns-1.
- Parameters:
comp- the component for which to query the Z ordering
- Returns:
- the Z ordering index of
compor-1ifcompis not a child of this Container
- Since:
- 1.5
- See Also:
setComponentZOrder(Component,int)
public Component[] getComponents()
Returns an array of the components in this container.
- Returns:
- The components in this container.
public SetgetFocusTraversalKeys(int id)
Returns the Set of focus traversal keys for a given traversal operation for this Container.
- Overrides:
- getFocusTraversalKeys in interface Component
- Throws:
IllegalArgumentException- If id is not one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS.
- Since:
- 1.4
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.
- Returns:
- this Container's focus traversal policy or null
- Since:
- 1.4
public Insets getInsets()
Returns the insets for this container, which is the space used for borders, the margin, etc.
- Returns:
- The insets for this container.
public LayoutManager getLayout()
Returns the current layout manager for this container.
- Returns:
- The layout manager for this container.
public Dimension getMaximumSize()
Returns the maximum size of this container.
- Overrides:
- getMaximumSize in interface Component
- Returns:
- The maximum size of this container.
public Dimension getMinimumSize()
Returns the minimum size of this container.
- Overrides:
- getMinimumSize in interface Component
- Returns:
- The minimum size of this container.
public Point getMousePosition(boolean allowChildren) throws HeadlessException
Returns the mouse pointer position relative to this Container's top-left corner. If allowChildren is false, the mouse pointer must be directly over this container. If allowChildren is true, the mouse pointer may be over this container or any of its descendents.
- Parameters:
allowChildren- true to allow descendents, false if pointer must be directly over Container.
- Returns:
- relative mouse pointer position
- Throws:
HeadlessException- if in a headless environment
public Dimension getPreferredSize()
Returns the preferred size of this container.
- Overrides:
- getPreferredSize in interface Component
- Returns:
- The preferred size of this container.
public Insets insets()
Deprecated. use
getInsets()insteadReturns the insets for this container, which is the space used for borders, the margin, etc.
- Returns:
- The insets for this container.
public void invalidate()
Invalidates this container to indicate that it (and all parent containers) need to be laid out.
- Overrides:
- invalidate in interface Component