location

Sets the component's actual location to (x, y) relative to its parent, like setLocation. A layout manager overrides this on its next layout pass, so it takes effect for components positioned by themselves - those in a null layout or a JLayeredPane.

x, y, and location each read-modify-write the live location, so they compose per axis with the later call in the modifier chain winning that axis: x(10).y(20) yields (10, 20), x(10) and y(20) combining; x(10).location(20, 30) yields (20, 30) (the later location wins the x axis); location(20, 30).x(10) yields (10, 30) (the later x wins the x axis, the y axis stays from location).

Return

this modifier with the location declared on it.

Parameters

x

the left edge in pixels, in the parent's coordinate space, whose origin is its top-left corner.

y

the top edge in pixels, measured down from that origin.

See also


Sets the component's actual location to point, like setLocation. See location (the Int overload) for how it takes effect only outside a managed layout and how location/x/y compose per axis.

Return

this modifier with the location declared on it.

Parameters

point

the top-left corner in the parent's coordinate space. It is compared against the location applied last, so mutating the same Point and declaring it again moves nothing; declare a fresh instance instead.

See also