Swing components & MVC Architecture
-
Upload
dhrumil-patel -
Category
Education
-
view
51 -
download
2
Transcript of Swing components & MVC Architecture
Swing Components1. 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
* 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
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.
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.
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.
• The SourceOf previous example
2. General Purpose Containers
1. Typically used to collect Basic Controls (JButton, JChoiceBox…)
2. Added to layout of top-level containers
JPanel
JFrame
3. Basic Controls
4. Uneditable Information Displays
5. Interactive Displays of Highly Formatted Information
MVC Architecture