JScrollPane Class
Package: javax.swing
The JScrollPane class creates scroll bars, which you use in conjunction with other controls such as text areas or list controls.
Note: This section doesn’t list any methods for the JScrollPane class. The JScrollPane class does have methods (plenty of them, in fact), but none of them are particularly useful for ordinary programming.
Constructors
|
Constructor |
Description |
|
|
Creates a scroll pane for the specified component |
|
|
Creates a scroll pane for the specified component with the specified policy for the vertical and horizontal scroll bars |
Fields
|
Field |
Description |
|
|
Always adds a vertical scroll bar |
|
|
Adds a vertical scroll bar if necessary |
|
|
Never adds a vertical scroll bar |
|
|
Always adds a horizontal scroll bar |
|
|
Adds a horizontal scroll bar if necessary |
|
|
Never adds a horizontal scroll bar |
The usual way to create a scroll pane is to use the second constructor. You use the first parameter of this constructor to specify the component to which you want to add scroll bars. To add scroll bars to a text area named MyTextArea, for example, you specify MyTextArea as the first parameter.
The second parameter tells the scroll pane whether to create a vertical ...
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