# Adding Scrollbars

Two types of scrolling components are available from the component palette:

- Scrollbar. Creates a standard vertical or horizontal scrollbar.
- Scrolling panel. Creates a panel that can be scrolled to view all the elements it contains.

To add a scrollbar:

1. Click on the scrollbar component in the AWT palette tab.
2. Click in the cell where you want to place the component.
3. Open the attribute editor by clicking on its button in the main toolbar.
4. Type a unique component ID in the name box.
5. (Optional) Set the vertical or horizontal orientation of the scrollbar with the orientation attribute in the attributes editor. The default position is vertical.

### Special Attributes

`minimum`/ `maximum` | Scrollbars are associated with an integer value that represents the user's location in the window. Use `minimum` and `maximum` to determine the range of those values. For example, if `minimum` and `maximum` are set to 0 and 100, and the scroll box is in the middle of the scrollbar, its value is 50. This value is available to the programmer to manipulate scrolling.
`lineIncrement` | The number added to or subtracted from the location value when the user clicks on the arrows at the ends of the scrollbar.
`headers` | Inserts the names of column headers.
`orientation` | Determines whether the scrollbar is oriented horizontally or vertically.
`pageIncrement` | The number added to or subtracted from the location value when the user clicks in the area between the scroll box and the arrows at each end of the scrollbar.
`value` | The integer value that represents the initial position of the slider/thumb relative to the values of `minimum` and `maximum`.
`visiblePageSize` | The initial length (in value units) of the slider/thumb. This length usually indicates the percentage of the entire document that can be viewed in the window that the scrollbar controls.

To add a scrolling panel:

1. Click on the Scrolling Panel component in the Panel palette tab.
2. Click in the cell where you want to place the component.
3. Add the desired components to the panel.
4. Open the attribute editor by clicking on its button in the toolbar.
5. Set the scrollAreaHeight attribute to determine the vertical scrolling area of the panel.
6. (Optional) Set the `scrollAreaWidth` attribute to determine the horizontal scrolling area of the panel.
7. Type a unique component ID in the name box.

### Special Attributes

`borderLabel` | Inserts the name of the panel at the top border.
`borderLabelAlignment` | Sets the position (left, right, center) of the label on the top border of the panel.
`borderRelief` | Sets the type of the border around the panel.
`borderWidth` | Sets the width of the border around the panel.
`scrollAreaHeight` | Sets the height of the visible portion of the panel.
`scrollAreaInsets` | Sets the placement of the scrollbar within the panel.
`scrollAreaWidth` | Sets the width of the visible portion of the panel, which determines whether a horizontal scrollbar is added.

See also:

  Laying Out the Interface
  Generating Java Source Code
  Adding Operations to Components
  GUI Builder Palette

  Visual Java GUI Builder API Documentation
    Visual Java GUI Builder Runtime Packages
    Class Hierarchy
    Index of All Fields and Methods