Component.getComponentAt

Component.getComponentAt

Class Overview | Class Members | This Package | All Packages

Syntax 1
public Component getComponentAt( int x, int y )
Parameters
x
the x coordinate.
y
the y coordinate.
Returns
the component or subcomponent that contains the (xy) location; null if the location is outside this component.
Description
Determines if this component or one of its immediate subcomponents contains the (xy) location, and if so, returns the containing component. This method only looks one level deep. If the point (xy) is inside a subcomponent that itself has subcomponents, it does not go looking down the subcomponent tree.

The locate method of Component simply returns the component itself if the (xy) coordinate location is inside its bounding box, and null otherwise.

See Also
contains



Syntax 2
public Component getComponentAt( Point p )
Parameters
p
the point.
Description
Returns the component or subcomponent that contains the specified point.

See Also
contains