Scroll Panes
Components in a GUI are often bigger than the area available to display them. To move from one part of the component to another, vertical and horizontal scrollbars are used.
In Swing, you offer scrolling by adding a component to a scroll pane, a container that is represented by the JScrollPane class.
You can create a scroll pane with the following constructors:
• JScrollPane()—Create a scroll pane with a horizontal and vertical scrollbar that appear as needed.
• JScrollPane(int, int)— Create a scroll pane with the specified vertical scrollbar and horizontal scrollbars.
• JScrollPane(Component)—Create a scroll pane that contains the specified user interface component.
• JScrollPane(Component, int, int)—Create a scroll pane with the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access