13.7. The ScrollPane Class

A ScrollPane is a borderless window used to contain something too large to show all at once. In essence, a scroll pane is a window without borders and without a LayoutManager. A ScrollPane can contain only a single component. However, this one component could be a Panel containing many other components.

Creating and Using a ScrollPane

Although several options are available for controlling a scroll pane programmatically, the most common use is to simply place a large Component or Container in the ScrollPane and let the user perform the scrolling through scrollbars. When creating a ScrollPane, you can specify three possible behaviors for the scrollbars: SCROLLBARS_ALWAYS, SCROLLBARS_AS_NEEDED, SCROLLBARS_NEVER. A ScrollPane ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.