If you've had to manually implement scrolling with the previous versions of the AWT, you'll surely appreciate the java.awt.ScrollPane class, which made its debut in the 1.1 release of the AWT.

java.awt.ScrollPane is a container, although it differs from other AWT containers in two ways:

  • Its layout manager is null and cannot be set.

  • It can only contain only one component at a time.

ScrollPane has a null layout manager;[4] its peer controls the placement of the scrollbars and the viewport. As a result, ScrollPane does not allow its layout manager to be set. ScrollPane.setLayout(), which is implemented as final so that it cannot be overridden in extensions, throws an exception if invoked.

[4] Containers have null layout managers ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.