Describes how to vary the font, color, or other formatting of text displayed by Swing components byusing HTML tags.
Tells you about the Swing model architecture. This variation on Model-View-Controller (MVC)means that you can, if you wish, specify how the data and state of a Swing component are stored andretrieved. The benefits are the ability to share data and state between components, and to greatlyimprove the performance of components such as tables that display large amounts of data.
Borders are very handy for drawing lines, titles, and empty space around the edges of components.(You might have noticed that the examples in this trail use a lot of borders.) This section tells youhow to add a border to any
Many Swing components can display icons. Usually, icons are implemented as instances of the
Solving Common Component Problems
This section discusses solutions to common component-related problems.
Questions and Exercises
Try these questions and exercises to test what you have learned in this lesson.
Using Top-Level Containers
As we mentioned before, Swing provides three generally useful top-level container classes:
. When using these classes, you should keep these facts in mind:
To appear onscreen, every GUI component must be part of a
.A containment hierarchy is a tree of components that has a top-level container as itsroot. We'll show you one in a bit.
Each GUI component can be contained only once. If a component is already in acontainer and you try to add it to another container, the component will be removedfrom the first container and then added to the second.
Each top-level container has a content pane that, generally speaking, contains(directly or indirectly) the visible components in that top-level container's GUI.
You can optionally add a menu bar to a top-level container. The menu bar is byconvention positioned within the top-level container, but outside the content pane.Some look and feels, such as the Mac OS look and feel, give you the option of placingthe menu bar in another place more appropriate for the look and feel, such as at thetop of the screen.