Scroll Panes
Components in a graphical user interface 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—this is standard behavior for a text area in software such as word processors and email programs.
In Swing, you offer scrolling by adding a component to a scroll pane, a container that is represented by the JScrollPane class in Swing.
You can create a scroll pane with the following constructors:
JScrollPane()— Create a scroll pane with a horizontal and vertical scrollbar that appear, if they are needed
JScrollPane(int, int)— Create a scroll pane with the specified vertical scrollbar and horizontal scrollbars
JScrollPane(Component)— Create ...
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