1. introduction to swing

31
Introduction to Swing

Transcript of 1. introduction to swing

Page 1: 1. introduction to swing

Introduction to

Swing

Page 2: 1. introduction to swing

What is Swing? a set of customizable graphical components

Page 3: 1. introduction to swing

Not just!

Page 4: 1. introduction to swing

Not only a set of customizable graphical components

but also next-generation GUI toolkit for enterprise dev

Page 5: 1. introduction to swing

Not only a set of customizable graphical components

but also next-generation GUI toolkit for enterprise dev

Page 6: 1. introduction to swing

Why was Swing born?

Page 7: 1. introduction to swing

History <<

Page 8: 1. introduction to swing

Java James Gosling

1991

Page 9: 1. introduction to swing

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

is based on peer-components

Page 10: 1. introduction to swing

What is peer-components?

Page 11: 1. introduction to swing

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

=> maintenance nightmare

#Prob2: limited functionalities, expensive on memory.

Page 12: 1. introduction to swing

AWT (Abstract Window Toolkit) is not enough!

Page 13: 1. introduction to swing

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

Page 14: 1. introduction to swing

JFC (Java Foundation Classes) JavaSoft

1997 – JavaOne Confer. in San Francisco

Page 15: 1. introduction to swing

JFC (Java Foundation Classes)

Page 16: 1. introduction to swing

Swing’s feature: Pluggable Look-and-Feels

Lightweight Components

Additional Feature

Page 17: 1. introduction to swing

Swing is based on MVC Architecture

Page 18: 1. introduction to swing

MVC Model: the state of data for each component

View: how you see the component

Controller: how the component interacts with event

Page 19: 1. introduction to swing

MVC in Swing simplified model-delegate

Page 20: 1. introduction to swing

MVC in Swing simplified model-delegate

Page 21: 1. introduction to swing

A Container contains components.

Page 22: 1. introduction to swing

Two types of containers: Top-level General-purpose

Page 23: 1. introduction to swing

Dig into container

Page 24: 1. introduction to swing

Glass pane

Page 25: 1. introduction to swing

Layered pane

Page 26: 1. introduction to swing

Content pane

Page 27: 1. introduction to swing

Menu pane

Page 28: 1. introduction to swing

Let’s imagine see the real things.

Page 29: 1. introduction to swing

Lightweight component referred Swing components

Page 30: 1. introduction to swing

JLabel JButton JCheckbox JRadioButton JTextField JTextArea

JPasswordField

Page 31: 1. introduction to swing

Homeworks

Do the workshop in Introduction to Swing follow video demo.

Read Swing components and Dialog Box