Appl clas nd architect.56


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Appl clas nd architect.56

  1. 1. Applet classes and Applet Arcrhitecture 1
  2. 2. ObjectivesOn completion of this period, you will be able to learn• Applet classes• Applet architecture 2
  3. 3. RecapIn 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 3
  4. 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 4
  5. 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 5
  6. 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 6
  7. 7. Applet MethodsThe following table shows the methods of Applet class Table.56.1 Applet methods 7
  8. 8. Applet Methods contd...Table.71.2 8
  9. 9. Applet Architecture• An applet is a window-based program• Applets are event driven• An applet waits until an event occurs 9
  10. 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 10
  11. 11. Applet Architecture contd..• User interacts with the applet• These interactions are sent to the applet as events to which the applet must respondFor example when the user clicks a mouse inside the applet’s window, a mouse-clicked event is generated 11
  12. 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 12
  13. 13. Summary In this class, you have learnt• Applet classes• Applet methods• Applet architecture 13
  14. 14. Quiz1. Applets are event driven programs a) true b) false 14
  15. 15. Quiz2. AWT notifies the applet about an event by calling an event handler a) true b) false 15
  16. 16. Frequently Asked Questions• List and Explain the different Applet classes and methods• Write about Applet architecture 16