Swing -Swing is the next generation of awt(advance version
of awt). swing components r 100% pure java components,
they has own Look And Feel that means platform
independent components but awt components r platform
dependent components because there is no concept of
Look & Feel.
swing components r light weight components, they all
r written in java itself. but awt components r written
in C++ that r the heavy weight components.
size of C++ exe file - more
size of java class file - less
loading time & varifying is less.
swing is the part of JFC (Java foundation classes)
java.lang.*;
java.util.*;
java.awt.*;
javax.swing.*;
Look And Feel -
MetalLookAndFeel - java look , default
MotifLookAndFeel - unix & Linux look
WindowsLookAndFeel - windows Look ,
MachintoshLookAndFeel - Machintosh look
OrganicLookAndFeel - organic look
prop awt Swing
1- Image Icon N Y
2- ToolTipText N Y
3- Toolbar N Y
4- TabbedPane N Y
5- Slider N Y
6- ComboBox N Y
7- Shortcut Keys(ctrl + alt) N Y
8- InternalFrame N Y
9- MsgBox & Inputbox N Y
10- Color Dialog N Y
11- Borders N Y
12- PasswordField N Y
13- RadioButton N Y
14- Tree N Y
15- Table N Y
16- ToggleButton N Y
17- lookand Feel N Y
18- ProgressBar N Y
19- Packages java.awt.*; javax.swing.*; x - for extended
20- Classes Button/Applet JButton / JApplet
21- components adding -
awt -
add(a1);
add(a2);
add(a3);
swing -
Component c = getContentPane();
c.add(a1);
c.add(a2);
c.add(a3);
c.add(a4);
JApplet & JFrame act like a container for other components.
but no need in jdk1.5 & jdk1.6 , in jdk1.5 & 1.6 we
can add components like awt.
** for changing the backcolor we need it(JApplet & JFrame).