1. introduction to swing

Preview:

Citation preview

Introduction to

Swing

What is Swing? a set of customizable graphical components

Not just!

Not only a set of customizable graphical components

but also next-generation GUI toolkit for enterprise dev

Not only a set of customizable graphical components

but also next-generation GUI toolkit for enterprise dev

Why was Swing born?

History <<

Java James Gosling

1991

AWT (Abstract Window Toolkit) is the only one toolkit to develop GUI in initial Java

is based on peer-components

What is peer-components?

AWT (Abstract Window Toolkit) #Prob1: similar components not the same in different OS

=> maintenance nightmare

#Prob2: limited functionalities, expensive on memory.

AWT (Abstract Window Toolkit) is not enough!

Aha!!! That’s why Swing was born.

JFC (Java Foundation Classes) JavaSoft

1997 – JavaOne Confer. in San Francisco

JFC (Java Foundation Classes)

Swing’s feature: Pluggable Look-and-Feels

Lightweight Components

Additional Feature

Swing is based on MVC Architecture

MVC Model: the state of data for each component

View: how you see the component

Controller: how the component interacts with event

MVC in Swing simplified model-delegate

MVC in Swing simplified model-delegate

A Container contains components.

Two types of containers: Top-level General-purpose

Dig into container

Glass pane

Layered pane

Content pane

Menu pane

Let’s imagine see the real things.

Lightweight component referred Swing components

JLabel JButton JCheckbox JRadioButton JTextField JTextArea

JPasswordField

Homeworks

Do the workshop in Introduction to Swing follow video demo.

Read Swing components and Dialog Box

Recommended