1. Applet classes and Applet Arcrhitecture
http://improvejava.blogspot.in/ 1
2. Objectives
On completion of this period, you will be able to
learn
• Applet classes
• Applet architecture
http://improvejava.blogspot.in/ 2
3. Recap
In the last class, you have studied about different
steps involved in executing an applet
• Applets do not need a main( ) method
• Applets must be run under an appletviewer or
a Java compatible browser
http://improvejava.blogspot.in/ 3
4. Applet Classes and Its Methods
• Applet class is defined in java.applet java.lang.Object
package
• Applet is a subclass of Panel class
java.awt.Component
which is defined in java.awt package
• Panel is a subclass of Container
class java.awt.Container
• Container is a sub class of
Component class java.awt.Panel
• Component is a subclass of Object
class
java.applet.Applet
• Object is the root of all Java classes
and is defined in java.lang package
Fig. 56.1 Applet class hierarchy
http://improvejava.blogspot.in/ 4
5. Applet Classes and its Methods
contd..
• Applet provides all necessary support for applet
execution, such as starting and stopping
• It also provides methods that load and display
images, and and play audio clips
http://improvejava.blogspot.in/ 5
6. Applet Classes and its Methods
contd..
• These classes provide support for Java’s
window-based, graphical interface
• Applet provides all of the necessary support for
window-based activities
http://improvejava.blogspot.in/ 6
7. Applet Methods
The following table shows the methods of Applet class
Table.56.1 Applet methods
http://improvejava.blogspot.in/ 7
9. Applet Architecture
• An applet is a window-based program
• Applets are event driven
• An applet waits until an event occurs
http://improvejava.blogspot.in/ 9
10. Applet Architecture contd..
• AWT notifies the applet about an event by
calling an event handler
• After this, the applet must take appropriate
action and then quickly return control to the AWT
http://improvejava.blogspot.in/ 10
11. Applet Architecture
contd..
• User interacts with the applet
• These interactions are sent to the applet as events to
which the applet must respond
For example
when the user clicks a mouse inside the applet’s
window, a mouse-clicked event is generated
http://improvejava.blogspot.in/ 11
12. Applet Architecture contd..
• If the user presses a key in the applet’s
window has input focus, a key press event is
generated
• When the user interacts with one of these
controls (Buttons and Check boxes, etc), an
event is generated
http://improvejava.blogspot.in/ 12
13. Summary
In this class, you have learnt
• Applet classes
• Applet methods
• Applet architecture
http://improvejava.blogspot.in/ 13
14. Quiz
1. Applets are event driven programs
a) true
b) false
http://improvejava.blogspot.in/ 14
15. Quiz
2. AWT notifies the applet about an event by
calling an event handler
a) true
b) false
http://improvejava.blogspot.in/ 15
16. Frequently Asked Questions
• List and Explain the different Applet classes
and methods
• Write about Applet architecture
http://improvejava.blogspot.in/ 16