{"id":778,"date":"2010-08-22T11:02:03","date_gmt":"2010-08-22T05:32:03","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=778"},"modified":"2010-08-22T11:02:03","modified_gmt":"2010-08-22T05:32:03","slug":"applet-lifecycle-of-applet","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/java\/applet-lifecycle-of-applet\/","title":{"rendered":"Lifecycle of Applet"},"content":{"rendered":"<p>Applet is a piece of program in which runs on JAVA enabled browsers.<\/p>\n<p><strong>LifeCycle of Applet:<\/strong><\/p>\n<ul>\n<li>init() \u00a0is called only once \u00a0in lifecycle of applet during creation.<\/li>\n<li>destroy() is called only once in applet lifecycle during disposal of applet.<\/li>\n<li>whenever applet gots focus(active) paint() is called.<\/li>\n<li>whenever applet is minimized stop() is called.<\/li>\n<li>whenever applet is maximized start() &amp; paint() is called.<\/li>\n<li>start(), stop() &amp; paint(Graphics g) can be called many times in applet lifecycle.<\/li>\n<\/ul>\n<p>Example :<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\n\npackage com.shivasoft.applet;\n\nimport java.applet.Applet;\nimport java.awt.Graphics;\n\npublic class AppletLifecycle extends Applet\n{\n  public void init()\n  {\n      System.out.println(&quot;Init State&quot;);\n  }\n\n  public void start()\n  {\n      System.out.println(&quot;Start State&quot;);\n  }\n\n  public void paint(Graphics g)\n  {\n      System.out.println(&quot;Paint State&quot;);\n   }\n\n   public void stop()\n   {\n        System.out.println(&quot;Stop State&quot;);\n   }\n\n   public void destroy()\n   {\n        System.out.println(&quot;Destroy State&quot;);\n    }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Example which shows the lifecycle of applet<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[3],"tags":[41],"class_list":["post-778","post","type-post","status-publish","format-standard","hentry","category-java","tag-applet"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":847,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/mouse-handling-in-applets-using-this\/","url_meta":{"origin":778,"position":0},"title":"Bouncing ball animation in Applet","author":"Jitendra","date":"August 25, 2010","format":false,"excerpt":"Example to show Bouncing ball animation in Applet","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"Mouse handling in applets using this pointer method, Bouncing ball","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/08\/bOUNCINGBall.jpeg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":999,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/bouncing-ball-applet-create-balls-on-mouse-click-of-random-color-and-random-size\/","url_meta":{"origin":778,"position":1},"title":"Bouncing ball applet &#8211; Create Balls on Mouse click of random color and random size","author":"Jitendra","date":"September 9, 2010","format":false,"excerpt":"Creating the balls on mouse click of random color, random size and random speed and bouncing around the wall of applet in JAVA.","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"Bouncing Ball applet - Create ball on Mouse click of random size and random color","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/09\/Bouncing-Ball-applet.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":867,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/textbox-button-anonymous-actionlistener\/","url_meta":{"origin":778,"position":2},"title":"Event Handling using Anonymous Class in Applet","author":"Jitendra","date":"August 25, 2010","format":false,"excerpt":"Source code to demonstrate the usage of anonymous class in Applet","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"Event Handling using Anonymous Class in Applet ","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/08\/AnonymousClass1.jpeg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":862,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/textbox-button-anonymous-actionlistner\/","url_meta":{"origin":778,"position":3},"title":"Event Handling using Inner Class in Applet","author":"Jitendra","date":"August 25, 2010","format":false,"excerpt":"Demonstrates the example for handling event using Inner Class in Java Applet","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"Event Handling using Inner Class in Applet","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/08\/InnerClassButton.jpeg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2049,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/explain-externalizable-in-java\/","url_meta":{"origin":778,"position":4},"title":"Explain Externalizable in Java","author":"Jitendra","date":"April 20, 2011","format":false,"excerpt":"Explain Externalizable in Java","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":724,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/simple-threading-techniques\/","url_meta":{"origin":778,"position":5},"title":"Thread, Life Cycle of Thread","author":"Jitendra","date":"August 7, 2010","format":false,"excerpt":"What is Thread? Life cycle of thread. Difference in start() and run() method of Thread. By Default how many thread runs?","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=778"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/778\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}