Java TM Look and Feel Design Guidelines: Advanced Topics > Part II: Special Topics > 5: Idioms > Container-and-Contents Idiom   Previous Next Contents/Index/Search


Container-and-Contents Idiom

Users sometimes need to view a hierarchy of containers--for example, a set of file folders--while also viewing the contents of a selected container--for example, the list of documents in a selected folder. You can provide this capability by using the Container-and-Contents idiom, which consists of a split pane displaying a different view in each of its two panes:

  • The left pane contains a tree component displaying a hierarchy of containers, one of which is selected. The left pane's selected container can contain leaf nodes as well as subcontainers.
  • The right pane contains a table or a set of icons representing the contents of the left pane's selected container. (A set of icons in a pane is known as an icon pane .)

For a description of split panes, see Chapter 7 of Java Look and Feel Design Guidelines , 2d ed.

Figure 62 shows the Container-and-Contents idiom used in the upper two panes of an email application.

Figure 62   Container-and-Contents Idiom in an Email Application


In the Container-and-Contents idiom, the left and right panes work together. Changing the selection in the left pane (the tree) changes which object's contents are displayed in the right pane (the table).

In the right pane, if a user opens a subcontainer:

  • That subcontainer becomes highlighted in the left and right panes.
  • Highlighting is removed from the left pane's previously highlighted item.

In Figure 62, the right pane displays the contents of only one container--labeled Inbox in the left pane--so this behavior does not apply to the figure.

The container-and-contents uses a single-selection model--that is, the selection can contain only one object at the time, although that object can be a container.

The following guidelines apply to the Container-and-Contents idiom:

 Ensure that clicking a container in the left pane causes the right pane to display that container's contents.

 Ensure that double-clicking a collapsed container in the left pane expands that container and makes its subnodes visible in the right pane. Likewise, ensure that double-clicking an expanded container in the left pane collapses that container and causes its subnodes to be become visible in the right pane.

Java Look and Feel Design Guidelines: Advanced Topics.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.
Previous Next Contents/Index/Search
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
Java 8 banner (182)