SWING - Java 2nd Lesson Notes
SWING - Java 2nd Lesson Notes
Swing is a GUI widget toolkit for java. It is part of Oracle’s Java Foundation
Classes (JFC)
- Hok AWT madhe apan kasa Button asa lihaycho tasa swing madhe JButton
Lihitat manje fakta “J” add kela jato sarting la…
Swing Features :
- 1. Light Weight
- 2. Rich Controls
- 3. Easy Mouseless Operations
- 4. Tolltips
- 5. Easy Scrolling
- 6. Pluggable Look and Feel
MVC Architecture :
- Swing components follow the MVC ( Model – View – Controller ) and
thus can provide a much more flexible UI
- MVC Features:
The data access
The business logic
User Interaction
MVC :
Model : this provides the means by which data is retrived and
manipulated.
View : this represents the visual interface components of the
Graphical User Interface (GUI) application which interact with the
user
Controller : this joins the MODEL & VIEW and is the heart of the
control logic by associating user-generated events with data actions.
Difference Between AWT & SWING :
Sr AWT Sr SWING
No No
1 AWT stands for Abstract 1 Swing is also called JFC’s
Windowing ToolKit (Java Foundation Classes)
2 AWT component require 2 Swing component require
java.awt package javax.swing package
3 Platform-Dependent Components 3 Platform-Independent
Components
4 Heavyweight 4 Lightweight
5 Does not Support Pluggable look 5 Supports Pluggable look & feel
& feel
6 Less components than swing 6 Swing provides more component
Advantages of Swing :
- Swing components are light weight
- Follows MVC thus it is more flexible UI
- Provides some additional components like :
JTree
JTable
Tabbed Panes
JScrollPane
JToolTip
JProgressBar
- Swing provides built-in double buffering
Disadvantages of Swing :
- It can be slower than AWT when you are not careful about
programming.
- Swing components might not behave exactly like native components
which look like native components.
- It requires Java 2 or separate JAR file.