JSplitPane

JSplitPane is a container that manages two (and only two) components. These children can be layed-out left-and-right or top-and-bottom. The user can interactively drag the shared boundary to resize the viewable window of both components simultaneously. The constant JSplitPane.HORIZONTAL_SPLIT is used to specify a left-and-right layout, and JSplitPane.VERTICAL_SPLIT designates top-and-bottom.

As with simple-minded layout manager classes, JSplitPane objects can be nested inside other JSplitPane objects to achieve many interesting configurations.

[Reference: Topley, pp727-734]


Text document model

JTextField and JTextArea implement the architectural roles of "view" and "controller". The "model" role is implemented by the Document abstraction. In the example, the first JTextArea is initialized with a String object. This results in an underlying Document object being created. Later, the second and third JTextAreas are configured to share the same "model".

There are now three separate, yet synchronized, views of the same model. As changes are made to one view, the model is updated, and notification is sent to all views so that each can update its presentation.

[Reference: Topley, p726]