visible

Sets isVisible - whether the component is shown in its parent's layout.

A hidden component stays attached to its parent and keeps its full native state (selection, scroll position, focus history, model), so toggling it back on recreates nothing. Reach for visible when you only need to hide a component that already exists.

Return

this chain with the visibility declared on it.

Parameters

visible

false stops the component painting, taking focus and receiving events, and hides its children with it; most layout managers skip it as well, though GridLayout and OverlayLayout still reserve its place. A component starts out visible unless its own constructor hides it - a window and a JInternalFrame both start hidden.

See also