gdata.io.handleScriptLoaded({"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$georss":"http://www.georss.org/georss","xmlns$thr":"http://purl.org/syndication/thread/1.0","xmlns$blogger":"http://schemas.google.com/blogger/2008","id":{"$t":"tag:blogger.com,1999:blog-913600556879440043"},"updated":{"$t":"2024-01-01T15:38:08.302+05:30"},"category":[{"term":"Data Structures"},{"term":"Vedic Mathematics"},{"term":"My Vlogs"},{"term":"Website Designing"},{"term":"Guest Blogging"},{"term":"Youtube"},{"term":"PPL"},{"term":"Android"},{"term":"Android App Development"},{"term":"High Performance Computing"},{"term":"Socket Programming"},{"term":"Java"},{"term":"Cloud Computing"},{"term":"Unboxing \u0026 Review"},{"term":"Database"},{"term":"OpenMPI"},{"term":"OPENCL"},{"term":"CUDA"},{"term":"LEX \u0026 YACC"},{"term":"Vocabulary"},{"term":"Compiler"},{"term":"Blogging Tips"},{"term":"Networking"},{"term":"Linux"},{"term":"Nanded City Pune"},{"term":"Parallel Computing"},{"term":"SDL"},{"term":"Fedora"},{"term":"Udemy Courses"},{"term":"Dia Software"},{"term":"MPI"},{"term":"Multithreading"},{"term":"Computer Networks"},{"term":"Abbreviations in Computer Science"},{"term":"Salesforce"},{"term":"Lisp"},{"term":"YouTube Tips"},{"term":"MS Excel Formulas \u0026 Functions"},{"term":"C Plus Plus Programming"},{"term":"GATE"},{"term":"Mysql"},{"term":"Google Forms"},{"term":"Wine"},{"term":"Swing"},{"term":"Mathematics"},{"term":"SQL"},{"term":"Amazon Links Summary"},{"term":"Thread Pool"},{"term":"General"},{"term":"Amazon Affiliate Program"},{"term":"How To Write Blog"},{"term":"C Programming"},{"term":"Applet"},{"term":"Selenium Automation Testing"},{"term":"Skill Development Lab"},{"term":"OPENMP"},{"term":"Python"},{"term":"Ubuntu"}],"title":{"type":"text","$t":"Computer Revolution (www.comrevo.com)"},"subtitle":{"type":"html","$t":""},"link":[{"rel":"http://schemas.google.com/g/2005#feed","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/-/Applet?alt\u003djson-in-script\u0026max-results\u003d6"},{"rel":"self","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/-/Applet?alt\u003djson-in-script\u0026max-results\u003d6"},{"rel":"alternate","type":"text/html","href":"http://www.comrevo.com/search/label/Applet"},{"rel":"hub","href":"http://pubsubhubbub.appspot.com/"}],"author":[{"name":{"$t":"Parag Jambhulkar"},"uri":{"$t":"https://www.blogger.com/profile/13991750622483538113"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"generator":{"version":"7.00","uri":"https://www.blogger.com","$t":"Blogger"},"openSearch$totalResults":{"$t":"4"},"openSearch$startIndex":{"$t":"1"},"openSearch$itemsPerPage":{"$t":"6"},"entry":[{"id":{"$t":"tag:blogger.com,1999:blog-913600556879440043.post-700972703036166147"},"published":{"$t":"2019-09-03T13:40:00.005+05:30"},"updated":{"$t":"2021-01-08T15:16:33.744+05:30"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Applet"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Java"}],"title":{"type":"text","$t":"Applet calculator program in Java | Simple calculator program in Java using awt"},"content":{"type":"html","$t":"\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; In this post, we will see \u003cb\u003eapplet calculator program in java | simple calculator program in java using awt.\u0026nbsp;\u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e\u003cbr /\u003e\u003c/b\u003e\u003c/span\u003e\n\u003cbr /\u003e\n\u003ca name\u003d'more'\u003e\u003c/a\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eFind details of \u003cu\u003eLife Cycle of Applet\u003c/u\u003e in this link: \u003ca href\u003d\"https://www.comrevo.com/2018/10/life-cycle-of-applet.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2018/10/life-cycle-of-applet.html\u003c/a\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eFind Java Applet Life Cycle Program Example in following link:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003ca href\u003d\"https://www.comrevo.com/2019/08/Java-Applet-Life-Cycle-Program-Java-program-to-demonstrate-applet-life-cycle-Example.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2019/08/Java-Applet-Life-Cycle-Program-Java-program-to-demonstrate-applet-life-cycle-Example.html\u003c/a\u003e\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eFind Java Applet Hello World Program Example in following link:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003ca href\u003d\"https://www.comrevo.com/2019/08/Java-Applet-Hello-World-Example-Java-Applet-Hello-World-Program.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2019/08/Java-Applet-Hello-World-Example-Java-Applet-Hello-World-Program.html\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eWatch following video (\u0026nbsp;Java Applet Tutorial | Java Applet Life Cycle | Hello World Applet Program in Java\u003c/span\u003e\u003cspan style\u003d\"font-size: x-large;\"\u003e\u0026nbsp;) :\u003c/span\u003e\u003c/b\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: x-large;\"\u003e\u003cb\u003e\n  \n  \u003ciframe allow\u003d\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen\u003d\"\" frameborder\u003d\"0\" height\u003d\"360\" src\u003d\"https://www.youtube.com/embed/3RyPFiR8qoE\" width\u003d\"640\"\u003e\u003c/iframe\u003e\n  \n  \n  \u003c/b\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eWatch on YouTube:\u0026nbsp;\u003ca href\u003d\"https://www.youtube.com/watch?v\u003d3RyPFiR8qoE\" target\u003d\"_blank\"\u003ehttps://www.youtube.com/watch?v\u003d3RyPFiR8qoE\u003c/a\u003e\u003c/b\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eExplanation:\u0026nbsp;\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Applet program does not have \u003cb\u003emain()\u003c/b\u003e\n method. Hence, it can not be used for creating stand-alone application.\n It is to be used with other applications like webpages created by JSP, \nServlet.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; We need to extend class \u003cb\u003eApplet\u003c/b\u003e given by package \u003cb\u003ejava.applet\u003c/b\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; We can override \u003cb\u003einit(), start(), stop(), destroy()\u003c/b\u003e methods given by Applet class. We may also need \u003cb\u003epaint()\u003c/b\u003e method to redraw applet. paint() method is given by \u003cb\u003eComponent\u003c/b\u003e class which is given by \u003cb\u003ejava.awt\u003c/b\u003e package. paint() method accepts \u003cb\u003eGraphics\u003c/b\u003e class object as parameter.\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; To handle events, we need to implement ActionListener inteface. We need to add components TextFields, Labels, Buttons etc. on applet. Component (e.g. Button) from which we want to generate event has to be registered for event by calling addActionListener() method. We have to implement actionPerformed() method to handle event. \u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Go through the following programs:\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: medium;\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eProgram (AppletCalculator.java)\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003eimport java.applet.*;\u003cbr /\u003eimport java.awt.*;\u003cbr /\u003eimport java.awt.event.*;\u003cbr /\u003e\u003cbr /\u003epublic class AppletCalculator extends Applet implements ActionListener \u003cbr /\u003e{\u003cbr /\u003e\u0026nbsp;\u0026nbsp; Label l1,l2,l3;\u003cbr /\u003e\u0026nbsp;\u0026nbsp; TextField t1,t2;\u003cbr /\u003e\u0026nbsp;\u0026nbsp; Button b1,b2,b3,b4;\u003cbr /\u003e\u003cbr /\u003e\u0026nbsp;\u0026nbsp; public void init()\u003cbr /\u003e\u0026nbsp;\u0026nbsp; {\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; setLayout(new FlowLayout());\u003cbr /\u003e\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l1\u003dnew Label(\"First Number:\");\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; t1\u003dnew TextField(20); \u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l2\u003dnew Label(\"Second Number:\");\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; t2\u003dnew TextField(20);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b1\u003dnew Button(\"Add\");\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b2\u003dnew Button(\"Sub\");\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b3\u003dnew Button(\"Mul\");\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b4\u003dnew Button(\"Div\");\u003cbr /\u003e\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l3\u003dnew Label(\"Result\");\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(l1);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(t1);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(l2);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(t2);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(b1);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(b2);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(b3);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(b4);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; add(l3);\u003cbr /\u003e\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b1.addActionListener(this);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b2.addActionListener(this);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b3.addActionListener(this);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; b4.addActionListener(this);\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026nbsp;\u0026nbsp; }\u003cbr /\u003e\u003cbr /\u003e\u0026nbsp;\u0026nbsp; public void actionPerformed(ActionEvent ae)\u003cbr /\u003e\u0026nbsp;\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; Double num1\u003dDouble.parseDouble(t1.getText());\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; Double num2\u003dDouble.parseDouble(t2.getText());\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; if(ae.getSource()\u003d\u003db1)\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Double value\u003dnum1+num2;\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l3.setText(\"\"+value);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; }\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; if(ae.getSource()\u003d\u003db2)\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Double value\u003dnum1-num2;\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l3.setText(\"\"+value);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; }\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; if(ae.getSource()\u003d\u003db3)\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Double value\u003dnum1*num2;\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l3.setText(\"\"+value);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; }\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; if(ae.getSource()\u003d\u003db4)\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Double value\u003dnum1/num2;\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; l3.setText(\"\"+value);\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; }\u003cbr /\u003e\u0026nbsp; } \u003cbr /\u003e}\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: medium;\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eProgram (AppletCalculator.html)\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u0026lt;html\u0026gt;\u003cbr /\u003e\u0026lt;head\u0026gt;\u0026lt;title\u0026gt;Applet Calculator\u0026lt;/title\u0026gt;\u0026lt;/head\u0026gt;\u003cbr /\u003e\u0026lt;body\u0026gt; \u003cbr /\u003e\u0026lt;applet code \u003d \"AppletCalculator.class\" width \u003d \"200\" height \u003d \"400\"\u0026gt;\u003cbr /\u003eIf your browser is Java enabled, then only you can see Applet in your browser. If it is not Java enabled,then you need to add Java plug-ins in your browser or use appletviewer to view applet. \u003cbr /\u003e\u0026lt;/applet\u0026gt;\u003cbr /\u003e\u0026lt;/body\u0026gt;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026lt;/html\u0026gt;\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e\u0026nbsp;How to run from terminal\u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003eparag@parag-Inspiron-N4010:~/Desktop/programs/applet$ \u003cb\u003ejavac AppletCalculator.java \u003c/b\u003e\u003cbr /\u003eparag@parag-Inspiron-N4010:~/Desktop/programs/applet$ \u003cb\u003eappletviewer \u003c/b\u003e\u003c/span\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eAppletCalculator\u003c/b\u003e\u003c/span\u003e.html\u003c/b\u003e\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb style\u003d\"font-family: \u0026quot;times new roman\u0026quot;; font-size: x-large;\"\u003eOutput: \u003c/b\u003e\u003cbr /\u003e\n\u003cdiv class\u003d\"separator\" style\u003d\"clear: both; text-align: center;\"\u003e\n\u003c/div\u003e\n\u003cdiv class\u003d\"separator\" style\u003d\"clear: both; text-align: center;\"\u003e\n\u003ca href\u003d\"https://1.bp.blogspot.com/-h6V32iU2z44/XW4f5MgNFvI/AAAAAAAAED0/gDdG1ST08mcAHKaCtPO8LKzIjyrkL97IgCLcBGAs/s1600/AppletCalculator.png\" style\u003d\"margin-left: 1em; margin-right: 1em;\"\u003e\u003cimg border\u003d\"0\" data-original-height\u003d\"557\" data-original-width\u003d\"251\" src\u003d\"https://1.bp.blogspot.com/-h6V32iU2z44/XW4f5MgNFvI/AAAAAAAAED0/gDdG1ST08mcAHKaCtPO8LKzIjyrkL97IgCLcBGAs/s1600/AppletCalculator.png\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eFind Life Cycle of Applet in following link:\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003ca href\u003d\"https://www.comrevo.com/2018/10/life-cycle-of-applet.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2018/10/life-cycle-of-applet.html\u003c/a\u003e .\u003c/span\u003e\u003c/b\u003e \u003cbr /\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\u003c/div\u003e\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https://www.comrevo.com/feeds/700972703036166147/comments/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https://www.comrevo.com/2019/09/applet-calculator-program-in-java-simple-calculator-program-in-java-using-awt.html#comment-form","title":"0 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/700972703036166147"},{"rel":"self","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/700972703036166147"},{"rel":"alternate","type":"text/html","href":"https://www.comrevo.com/2019/09/applet-calculator-program-in-java-simple-calculator-program-in-java-using-awt.html","title":"Applet calculator program in Java | Simple calculator program in Java using awt"}],"author":[{"name":{"$t":"Parag Jambhulkar"},"uri":{"$t":"https://www.blogger.com/profile/13991750622483538113"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https://i.ytimg.com/vi/3RyPFiR8qoE/default.jpg","height":"72","width":"72"},"thr$total":{"$t":"0"}},{"id":{"$t":"tag:blogger.com,1999:blog-913600556879440043.post-5426660990327054213"},"published":{"$t":"2019-08-31T14:37:00.000+05:30"},"updated":{"$t":"2019-09-03T13:42:19.325+05:30"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Applet"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Java"}],"title":{"type":"text","$t":"Java Applet Life Cycle Program | Java program to demonstrate applet life cycle | Example"},"content":{"type":"html","$t":"\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; In this post, we will see \u003cb\u003eJava Applet Life Cycle Program | Java program to demonstrate applet life cycle | Example\u0026nbsp;\u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003ca name\u003d'more'\u003e\u003c/a\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eFind details of \u003cu\u003eLife Cycle of Applet\u003c/u\u003e in this link: \u003ca href\u003d\"https://www.comrevo.com/2018/10/life-cycle-of-applet.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2018/10/life-cycle-of-applet.html\u003c/a\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eExplanation:\u0026nbsp;\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Applet program does not have \u003cb\u003emain()\u003c/b\u003e\n method. Hence, it can not be used for creating stand-alone application.\n It is to be used with other applications like webpages created by JSP, \nServlet.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; We need to extend class \u003cb\u003eApplet\u003c/b\u003e given by package \u003cb\u003ejava.applet\u003c/b\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; We can override \u003cb\u003einit(), start(), stop(), destroy()\u003c/b\u003e methods given by Applet class. We may also need \u003cb\u003epaint()\u003c/b\u003e method to redraw applet. paint() method is given by \u003cb\u003eComponent\u003c/b\u003e class which is given by \u003cb\u003ejava.awt\u003c/b\u003e package. paint() method accepts \u003cb\u003eGraphics\u003c/b\u003e class object as parameter. \u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Go through the following programs:\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: medium;\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eProgram (AppletLifeCycle.java)\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003eimport java.applet.*;\u003cbr /\u003eimport java.awt.*;\u003cbr /\u003e\u003cbr /\u003epublic class AppletLifeCycle extends Applet\u003cbr /\u003e{\u003cbr /\u003e\u0026nbsp; public void init()\u003cbr /\u003e\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; System.out.println(\"Applet is initialized\");\u003cbr /\u003e\u0026nbsp; }\u003cbr /\u003e\u0026nbsp; public void start()\u003cbr /\u003e\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; System.out.println(\"Applet is started\");\u003cbr /\u003e\u0026nbsp; }\u003cbr /\u003e\u0026nbsp; public void stop()\u003cbr /\u003e\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; System.out.println(\"Applet execution is stopped\");\u003cbr /\u003e\u0026nbsp; }\u003cbr /\u003e\u0026nbsp; public void paint(Graphics g)\u003cbr /\u003e\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; System.out.println(\"Painting the Applet\");\u003cbr /\u003e\u0026nbsp; }\u003cbr /\u003e\u0026nbsp; public void destroy()\u003cbr /\u003e\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; System.out.println(\"Applet is Destroyed\");\u003cbr /\u003e\u0026nbsp; }\u003cbr /\u003e}\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: medium;\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eProgram (AppletLifeCycle.html)\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u0026lt;html\u0026gt;\u003cbr /\u003e\u0026lt;head\u0026gt;\u0026lt;title\u0026gt;Applet Life Cycle\u0026lt;/title\u0026gt;\u0026lt;/head\u0026gt;\u003cbr /\u003e\u0026lt;body\u0026gt; \u003cbr /\u003e\u0026lt;applet code \u003d \"AppletLifeCycle.class\" width \u003d \"300\" height \u003d \"300\"\u0026gt;\u003cbr /\u003eIf your browser is Java enabled, then only you can see Applet in your browser. If it is not Java enabled,then you need to add Java plug-ins in your browser or use appletviewer to view applet. \u003cbr /\u003e\u0026lt;/applet\u0026gt;\u003cbr /\u003e\u0026lt;/body\u0026gt;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026lt;/html\u0026gt;\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e\u0026nbsp;Output:\u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003eparag@parag-Inspiron-N4010:~/Desktop/programs/applet$ \u003cb\u003ejavac AppletLifeCycle.java\u003c/b\u003e \u003cbr /\u003eparag@parag-Inspiron-N4010:~/Desktop/programs/applet$ \u003cb\u003eappletviewer AppletLifeCycle.html\u003c/b\u003e \u003cbr /\u003eApplet is initialized\u003cbr /\u003eApplet is started\u003cbr /\u003ePainting the Applet\u003cbr /\u003eApplet execution is stopped\u003cbr /\u003eApplet is started\u003cbr /\u003ePainting the Applet\u003cbr /\u003eApplet execution is stopped\u003cbr /\u003eApplet is started\u003cbr /\u003ePainting the Applet\u003cbr /\u003eApplet execution is stopped\u003cbr /\u003eApplet is Destroyed\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cdiv class\u003d\"separator\" style\u003d\"clear: both; text-align: center;\"\u003e\n\u003ca href\u003d\"https://1.bp.blogspot.com/-lVKm-DG_aUU/XWo37CvGwYI/AAAAAAAAEDQ/4ZmOYYtkEKwdBrUZDtIFKMYYDvHrvCDzQCLcBGAs/s1600/AppletLifeCycle.png\" imageanchor\u003d\"1\" style\u003d\"margin-left: 1em; margin-right: 1em;\"\u003e\u003cimg border\u003d\"0\" data-original-height\u003d\"376\" data-original-width\u003d\"298\" src\u003d\"https://1.bp.blogspot.com/-lVKm-DG_aUU/XWo37CvGwYI/AAAAAAAAEDQ/4ZmOYYtkEKwdBrUZDtIFKMYYDvHrvCDzQCLcBGAs/s1600/AppletLifeCycle.png\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eExplanation: \u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\u0026nbsp; If you look at the output in terminal, you can find init() method is called only once. After init() method start() and paint() methods are called.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\u0026nbsp; If applet is minimized, then stop() method is called.\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\u0026nbsp; If you reopen it, start() and paint() methods are called.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\u0026nbsp; If you close the applet, destroy() method is called. \u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eFind Life Cycle of Applet in following link:\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003ca href\u003d\"https://www.comrevo.com/2018/10/life-cycle-of-applet.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2018/10/life-cycle-of-applet.html\u003c/a\u003e .\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eFind Applet Hello World Program Example in following link:\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003ca href\u003d\"https://www.comrevo.com/2019/08/Java-Applet-Hello-World-Example-Java-Applet-Hello-World-Program.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2019/08/Java-Applet-Hello-World-Example-Java-Applet-Hello-World-Program.html\u003c/a\u003e .\u003c/span\u003e\u003c/b\u003e \u003c/div\u003e\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https://www.comrevo.com/feeds/5426660990327054213/comments/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https://www.comrevo.com/2019/08/Java-Applet-Life-Cycle-Program-Java-program-to-demonstrate-applet-life-cycle-Example.html#comment-form","title":"0 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/5426660990327054213"},{"rel":"self","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/5426660990327054213"},{"rel":"alternate","type":"text/html","href":"https://www.comrevo.com/2019/08/Java-Applet-Life-Cycle-Program-Java-program-to-demonstrate-applet-life-cycle-Example.html","title":"Java Applet Life Cycle Program | Java program to demonstrate applet life cycle | Example"}],"author":[{"name":{"$t":"Parag Jambhulkar"},"uri":{"$t":"https://www.blogger.com/profile/13991750622483538113"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https://1.bp.blogspot.com/-lVKm-DG_aUU/XWo37CvGwYI/AAAAAAAAEDQ/4ZmOYYtkEKwdBrUZDtIFKMYYDvHrvCDzQCLcBGAs/s72-c/AppletLifeCycle.png","height":"72","width":"72"},"thr$total":{"$t":"0"}},{"id":{"$t":"tag:blogger.com,1999:blog-913600556879440043.post-1821993364355484846"},"published":{"$t":"2019-08-31T11:59:00.000+05:30"},"updated":{"$t":"2019-09-03T13:41:59.020+05:30"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Applet"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Java"}],"title":{"type":"text","$t":"Java Applet Hello World Example | Java Applet Hello World Program"},"content":{"type":"html","$t":"\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; In this post, we will see \u003cb\u003eJava Applet Hello World Example | Java Applet Hello World Program.\u003c/b\u003e\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ca name\u003d'more'\u003e\u003c/a\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eFind details of \u003cu\u003eLife Cycle of Applet\u003c/u\u003e in this link: \u003ca href\u003d\"https://www.comrevo.com/2018/10/life-cycle-of-applet.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2018/10/life-cycle-of-applet.html\u003c/a\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eExplanation:\u0026nbsp;\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Applet program does not have \u003cb\u003emain()\u003c/b\u003e method. Hence, it can not be used for creating stand-alone application. It is to be used with other applications like webpages created by JSP, Servlet.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; We need to extend class \u003cb\u003eApplet\u003c/b\u003e given by package \u003cb\u003ejava.applet\u003c/b\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; We can override \u003cb\u003einit(), start(), stop(), destroy()\u003c/b\u003e methods given by Applet class. We may also need \u003cb\u003epaint()\u003c/b\u003e method to redraw applet. paint() method is given by \u003cb\u003eComponent\u003c/b\u003e class which is given by \u003cb\u003ejava.awt\u003c/b\u003e package. paint() method accepts \u003cb\u003eGraphics\u003c/b\u003e class object as parameter. \u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Go through the following programs:\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: medium;\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eProgram (HelloWorldApplet.java)\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003eimport java.applet.*;\u003cbr /\u003eimport java.awt.*;\u003cbr /\u003e\u003cbr /\u003epublic class HelloWorldApplet extends Applet \u003cbr /\u003e{\u003cbr /\u003e\u0026nbsp; public void paint(Graphics g) \u003cbr /\u003e\u0026nbsp; {\u003cbr /\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp; g.drawString(\"Hello World\", 100, 100); \u003cbr /\u003e\u0026nbsp; }\u003cbr /\u003e}\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: medium;\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eProgram (HelloWorldApplet.html)\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u0026lt;html\u0026gt;\u003cbr /\u003e\u0026lt;head\u0026gt;\u0026lt;title\u0026gt;Hello World Applet\u0026lt;/title\u0026gt;\u0026lt;/head\u0026gt;\u003cbr /\u003e\u0026lt;body\u0026gt; \u003cbr /\u003e\u0026lt;applet code \u003d \"HelloWorldApplet.class\" width \u003d \"300\" height \u003d \"300\"\u0026gt;\u003cbr /\u003eIf your browser is Java enabled, then only you can see Applet in your browser. If it is not Java enabled, then you need to add Java plug-ins in your browser or use appletviewer to view applet. \u003cbr /\u003e\u0026lt;/applet\u0026gt;\u003cbr /\u003e\u0026lt;/body\u0026gt;\u0026nbsp;\u0026nbsp; \u003cbr /\u003e\u0026lt;/html\u0026gt;\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e\u0026nbsp;How to run from terminal\u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ctable border\u003d\"1\"\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003ctd\u003e\u003cspan style\u003d\"font-size: large;\"\u003eparag@parag-Inspiron-N4010:~/Desktop/programs/applet$ \u003cb\u003ejavac HelloWorldApplet.java \u003c/b\u003e\u003cbr /\u003eparag@parag-Inspiron-N4010:~/Desktop/programs/applet$ \u003cb\u003eappletviewer HelloWorldApplet.html\u003c/b\u003e\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp;\u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb style\u003d\"font-family: 'times new roman'; font-size: x-large;\"\u003eOutput: \u003c/b\u003e\u003cbr /\u003e\n\u003cdiv class\u003d\"separator\" style\u003d\"clear: both; text-align: center;\"\u003e\n\u003ca href\u003d\"https://1.bp.blogspot.com/-wrA8hd_5PUQ/XWoQrA0ELvI/AAAAAAAAEDE/FxcZTAOYKzoljOAGw9zcAo00o_Y6PrOQACLcBGAs/s1600/HelloWorldApplet.png\" imageanchor\u003d\"1\" style\u003d\"margin-left: 1em; margin-right: 1em;\"\u003e\u003cimg border\u003d\"0\" data-original-height\u003d\"376\" data-original-width\u003d\"299\" src\u003d\"https://1.bp.blogspot.com/-wrA8hd_5PUQ/XWoQrA0ELvI/AAAAAAAAEDE/FxcZTAOYKzoljOAGw9zcAo00o_Y6PrOQACLcBGAs/s1600/HelloWorldApplet.png\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u003c/span\u003e\u003cbr /\u003e\n\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eFind Life Cycle of Applet in following link:\u003c/span\u003e\u003c/b\u003e\u003cbr /\u003e\n\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003ca href\u003d\"https://www.comrevo.com/2018/10/life-cycle-of-applet.html\" target\u003d\"_blank\"\u003ehttps://www.comrevo.com/2018/10/life-cycle-of-applet.html\u003c/a\u003e .\u003c/span\u003e\u003c/b\u003e \u003c/div\u003e\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https://www.comrevo.com/feeds/1821993364355484846/comments/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https://www.comrevo.com/2019/08/Java-Applet-Hello-World-Example-Java-Applet-Hello-World-Program.html#comment-form","title":"0 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/1821993364355484846"},{"rel":"self","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/1821993364355484846"},{"rel":"alternate","type":"text/html","href":"https://www.comrevo.com/2019/08/Java-Applet-Hello-World-Example-Java-Applet-Hello-World-Program.html","title":"Java Applet Hello World Example | Java Applet Hello World Program"}],"author":[{"name":{"$t":"Parag Jambhulkar"},"uri":{"$t":"https://www.blogger.com/profile/13991750622483538113"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https://1.bp.blogspot.com/-wrA8hd_5PUQ/XWoQrA0ELvI/AAAAAAAAEDE/FxcZTAOYKzoljOAGw9zcAo00o_Y6PrOQACLcBGAs/s72-c/HelloWorldApplet.png","height":"72","width":"72"},"thr$total":{"$t":"0"}},{"id":{"$t":"tag:blogger.com,1999:blog-913600556879440043.post-1987346534319959589"},"published":{"$t":"2018-10-08T11:22:00.001+05:30"},"updated":{"$t":"2021-01-08T15:16:29.401+05:30"},"category":[{"scheme":"http://www.blogger.com/atom/ns#","term":"Applet"},{"scheme":"http://www.blogger.com/atom/ns#","term":"Java"}],"title":{"type":"text","$t":"Life Cycle of Applet"},"content":{"type":"html","$t":"\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; In this post, we will see Life Cycle of an Applet.\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" style\u003d\"text-align: left;\" trbidi\u003d\"on\"\u003e\u003cdiv dir\u003d\"ltr\" trbidi\u003d\"on\"\u003e\u003cb\u003e\u003cspan style\u003d\"font-size: large;\"\u003eWatch following video (\u0026nbsp;Java Applet Tutorial | Java Applet Life Cycle | Hello World Applet Program in Java\u003c/span\u003e\u003cspan style\u003d\"font-size: x-large;\"\u003e\u0026nbsp;) :\u003c/span\u003e\u003c/b\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: x-large;\"\u003e\u003cb\u003e\u003ciframe allow\u003d\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen\u003d\"\" frameborder\u003d\"0\" height\u003d\"360\" src\u003d\"https://www.youtube.com/embed/3RyPFiR8qoE\" width\u003d\"640\"\u003e\u003c/iframe\u003e\u003c/b\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv dir\u003d\"ltr\" trbidi\u003d\"on\"\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eWatch on YouTube:\u0026nbsp;\u003ca href\u003d\"https://www.youtube.com/watch?v\u003d3RyPFiR8qoE\" target\u003d\"_blank\"\u003ehttps://www.youtube.com/watch?v\u003d3RyPFiR8qoE\u003c/a\u003e\u003c/b\u003e\u003c/span\u003e\u003c/div\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; Check following diagram:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003ca name\u003d'more'\u003e\u003c/a\u003e\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cbr /\u003e\n\u003cdiv class\u003d\"separator\" style\u003d\"clear: both; text-align: center;\"\u003e\n\u003ca href\u003d\"https://3.bp.blogspot.com/-l08SH2sXQfg/W7rq_Qm8voI/AAAAAAAAD38/G6P2TLfG1scqzSf-PDYQd23Hjyy-veO6QCLcBGAs/s1600/Life%2BCycle%2Bof%2BApplet.jpeg\" style\u003d\"margin-left: 1em; margin-right: 1em;\"\u003e\u003cimg border\u003d\"0\" data-original-height\u003d\"209\" data-original-width\u003d\"630\" src\u003d\"https://3.bp.blogspot.com/-l08SH2sXQfg/W7rq_Qm8voI/AAAAAAAAD38/G6P2TLfG1scqzSf-PDYQd23Hjyy-veO6QCLcBGAs/s1600/Life%2BCycle%2Bof%2BApplet.jpeg\" /\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eLife Cycle of Applet consists of four phases:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e1. Applet Initialized\u003c/b\u003e:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;Objects regarding Applet get initialized\u0026nbsp;in this phase. An init() method is called for the same purpose.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e2. Applet Running\u003c/b\u003e:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;Applets are embedded in a webpage. When a part of webpage which consists of applet is shown on a screen, then applet is in Running phase. A start() method is called, which takes applet to the Running phase.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e3. Applet Stopped\u003c/b\u003e:\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp;When a webpage in minimized or webpage is scrolled down/up; so that, applet is disappeared from the screen, then applet is in Stopped phase. Stop() method is called when applet is disappeared from the screen.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003e4. Applet Destroyed:\u003c/b\u003e\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; \u0026nbsp; When you closed the webpage which consists of applet, applet is get destroyed. A destroy() method is called when applet is destroyed.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cb\u003eNote:\u003c/b\u003e \u003cu\u003epublic void init()\u003c/u\u003e, \u003cu\u003epublic void start()\u003c/u\u003e, \u003cu\u003epublic void stop()\u003c/u\u003e, \u003cu\u003epublic void destroy()\u003c/u\u003e methods are given by \u003cu\u003eApplet class\u003c/u\u003e. Applet class is given by package \u003cu\u003ejava.applet\u003c/u\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003eOne more method, \u003cu\u003epublic void paint(Graphics g)\u003c/u\u003e , is used in life cycle of applet. It is used to redraw applet. It is given by \u003cu\u003eComponent class\u003c/u\u003e. Component class is given by package \u003cu\u003ejava.awt\u003c/u\u003e.\u003c/span\u003e\u003cbr /\u003e\n\u003cspan style\u003d\"font-size: large;\"\u003e\u003cbr /\u003e\u003c/span\u003e\u003c/div\u003e\n"},"link":[{"rel":"replies","type":"application/atom+xml","href":"https://www.comrevo.com/feeds/1987346534319959589/comments/default","title":"Post Comments"},{"rel":"replies","type":"text/html","href":"https://www.comrevo.com/2018/10/life-cycle-of-applet.html#comment-form","title":"0 Comments"},{"rel":"edit","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/1987346534319959589"},{"rel":"self","type":"application/atom+xml","href":"https://www.blogger.com/feeds/913600556879440043/posts/default/1987346534319959589"},{"rel":"alternate","type":"text/html","href":"https://www.comrevo.com/2018/10/life-cycle-of-applet.html","title":"Life Cycle of Applet"}],"author":[{"name":{"$t":"Parag Jambhulkar"},"uri":{"$t":"https://www.blogger.com/profile/13991750622483538113"},"email":{"$t":"noreply@blogger.com"},"gd$image":{"rel":"http://schemas.google.com/g/2005#thumbnail","width":"35","height":"35","src":"//www.blogger.com/img/blogger_logo_round_35.png"}}],"media$thumbnail":{"xmlns$media":"http://search.yahoo.com/mrss/","url":"https://i.ytimg.com/vi/3RyPFiR8qoE/default.jpg","height":"72","width":"72"},"thr$total":{"$t":"0"}}]}});