Title: JAVA SWING
1JAVA SWING
- By
- Tahira Braschi
- April 20, 2001
- Dr. Marchant
- CS 108-002
2What is JFC?
- JFC stands for Java Foundation Classes, and it
includes a group of features to help people build
GUIs (Graphical User Interfaces). - Features which help defined JFC are
- The Swing components
- Pluggable Look and Feel Support
- Accessibility API (Application Programmer
Interface) - Java 2D API
- Drag and Drop Support
3Swing
- Swing is the codename of the project that
developed the new components. It is not the
official name. - However, its frequently used to refer to the new
components and related API.
4Swing Components
- Part of the Java Foundation Classes (JFC), and
can be used with either JDK 1.1 or the Java 2
platform. - Include everything buttons, lists, menus,
tables, text areas, and containers such as
windows and tool bars.
5Top-Level Containers
Appletyou should know that by now!
Dialogwindows that are more limited than frames.
- Frameis a window that has decorations such as a
border, a title, and buttons for closing and
iconifying the window. Applications with a GUI
typically use at least one frame.
6General-Purpose Containers
- Intermediate containers which can be used under
many different circumstances - Panel
- Scroll pane
- Split pane
- Tabbed pane
- Tool bar
7General Purpose Containers
- Panelmost flexible and frequently used. Add
almost no functionality beyond what all objects
have. Often used to group components. - Scroll paneprovides scroll bars around a large
or growable component. - Split panedisplays two components in a fixed
amount of space, letting the user adjust the
amount of space devoted to each component.
8General Purpose Containers
- Tabbed panecontains multiple components but show
only one at a time. The user can easily switch
between components. - Tool barholds a group of components (usually
buttons) in a row or column, optionally allowing
the user to drag the tool bar into different
locations.
9General-Purpose Containers
Panel
Split pane
Scroll Pane
Tool bar
Tabbed pane
10Special-Purpose Containers
- Intermediate containers that play specific roles
in the use interface. - Internal frame Able to display display a
Frame-like window within another window. Usually,
you add internal frames to a desktop pane. - Layered frameProvides a third dimension for
positioning components depth, also known as Z
order. - Root paneHas 4 parts glass pane, layered pane,
content pane, and the (optional) menu bar.
11Special-Purpose Containers
Internal Frame
Layered Pane
Root Pane
12Basic Controls
- Atomic components that exist primarily to get
input from the user they generally also show
simple state. - Buttonscan be square or round
- Combo Boxcan be uneditable and editable.
- ListPresents the user with a group of items,
displayed in a column, to choose from. - Menuprovides a space-saving way to let the user
choose one of several options. - Sliderlets user enter a numeric value bounded by
a minimum and maximum value. - Text Fieldsbasic text control that lets the user
enter a small amount of text.
13Basic Controls
List
Buttons
Combo Box
Slider
Text Fields
Menu
14Uneditable Information Displays
- Atomic components that exist solely to give the
user information. - Labelable to display unselectable text and
images. - Progress Bardisplays the progress of a
long-running task (also, ProgressMonitor and
ProgressMonitorInputStream) - Tool tipcomes up when the user of the program
pauses with the cursor over any of the program's
buttons
15Uneditable Information Displays
Progress Bar
Label
Tool Tips
16Editable Displays of Formatted Information
- Atomic components that display highly formatted
information that can be edited by the user. - Color chooserprovide users with a palette of
colors to choose from. - File chooserprovide a GUI for navigating the
file system, and then either choosing a file or
directory from a list or entering a file name or
directory name. - Tabledisplays tables of data, optionally
allowing the user to edit the data. - Textdisplays text and allows user to edit it
- Treedisplays data in hierarchical way
17Editable Displays of Formatted Information
File Chooser
Color Chooser
Tree
Table
Text
18Pluggable Look Feel Support
- Gives any program that uses Swing components a
choice of looks and feels. For example, the same
program can use either the Java look-and-feel or
the Windows look-and-feel. - Many more look-and-feel packages will be
available in the future from various sources,
including some that use sound instead of a visual
look.
19Pluggable Look Feel Support
Java Look-and-feel
CDE/Motif Look-and-feel
Windows Look-and-feel
20Accessibility API
- Enables assistive technologies such as screen
readers and Braille displays (for blind people)
to get information from the user interface. - Primarily, assistive technologies exist to enable
people with permanent or temporary disabilities
to use the computer. - For example, if you get carpal tunnel syndrome,
you can use assistive technologies to accomplish
your work without using your hands.
21Java 2D API
Java 2 Platform only
- Enables developers to easily incorporate
high-quality 2D graphics, text, and images in
applications and in applets. - Enables you to display complex charts and graphs
that use various line and fill styles to
distinguish sets of data. - Enables you to store and to manipulate image
databy performing image-filter operations, such
as blur and sharpen.
22Drag and Drop Support
- Java 2 Platform only
- Provides the ability to drag and drop between a
Java application and a native application.
23For more information on
- Go to java.sun.com. This is a very useful site
and it is where I got my information for this
presentation - Theres a tutorial which takes you step by step
on how to use Swing components.
24Questions
- What is JFC?
- What is Swing?
- Name the Swing components?
- Name 3 general purpose containers of Swing?
- What does the Pluggable look and feel support
does?
25Thank you!!!
Thank you for your time! No, no questions,
please!!!!
or else youll be running after class!
26END