Advanced Swing Containers
Apress eBooks · 2006
In this chapter, you explored several high-level Swing containers. With the Box class, you can more easily utilize the BoxLayout manager to create a single row or column of components, honoring the minimum, preferred, and maximum size of the components the best way possible. With the JSplitPane component, you can create a row or column consisting of two components with a divider in between them to allow an end user to alter the components’ sizes manually by moving the divider. The JTabbedPane container displays only one component from a set of contained components at a time. The displayed component is picked by the user selecting a tab, which can contain a title with or without mnemonic, an icon, and a tooltip. This is the popular property sheet metaphor commonly seen within applications. The JScrollPane and JViewport containers allow you to display a large component within a small area. The JScrollPane adds scrollbars to enable an end user to move the visible part around, whereas the JViewport doesn’t add these scrollbars. In Chapter 12, we’ll once again examine the individual components within the Swing library, including the JProgressBar, JScrollBar, and JSlider that share the BoundedRangeModel as their data model.