Swing is a set of program component s for Java programmers that provide the ability to create graphical user interface ( GUI ) components, such as buttons and scroll bars.
1. Swing Components
1. What are Swing Components
2. Top Level Containers
3. General Purpose Containers
4. Basic Controls
5. Uneditable Information Displays
6. Interactive Displays of Highly Formatted Information
2. * Swing components are basic building blocks of an application.
* Swing has a wide range of various components, including buttons,
check boxes, sliders, and list boxes.
1. What are Swing Components
3. 1. Top Level Containers
* Every program with a Swing GUI must contain at least one top-level Swing
container that provides the support that Swing components need to perform
their painting and event handling.
* Swing provides three generally useful top-level container classes:
1. JFrame 2. JDialog 3. JApplet.
* Each JFrame object implements a single main window, and each JDialog
implements a secondary window (a window that's dependent on another
window). Each JApplet object implements an applet's display area within a
browser window.
4. When using these classes, you should keep these facts in
mind:
• To appear onscreen, every GUI component must be part of a
containment hierarchy. Each containment hierarchy has a top-level
container as its root.
• Each top-level container has a content pane that, generally speaking,
contains 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 positioned within the top-level container, but outside
the content pane.
5. Here's a picture of a frame created by an application.
The frame contains a green menu bar (with no menus)
and, in the frame's content pane, a large blank, yellow
label.