Modern GUI programs offer the possibility to easily access status
informations and functionalities by means of various menus, toolbars and
information panels. However, as a program becomes more complex, or in the
case where users have the possibility to configure and extend these
components, they often tend to get overfilled. This leads to scrambled or
even truncated components.
This article introduces a new container component called
ScrollableBar, which can be used as a wrapper for any Swing component. As
long as there is enough place to layout the contained component,
ScrollableBar is completely transparent. As soon as the available space
gets too small however, ScrollableBar will fade in two small arrow
buttons on the left and the right side (or on the top and the bottom side if
in vertical mode), which can be used to scroll the underlying component, thus
avoiding the above mentioned problems.
ScrollableBar is a lightweight container derived from
JComponent which uses the standard Swing classes JViewport and
JButton to achieve its functionality. It fills a gap in the set of
the standard Swing components and offers the possibility to create more
robust and intuitive user interfaces.
Notice: This is a preliminary version of the paper published in
Java Developer Journal Vol 9/Issue 7, July 2004
PDF Version (1.6Mb),
The source code presented in the paper is available for download as a single jar-file