{"id":867,"date":"2010-08-25T23:17:04","date_gmt":"2010-08-25T17:47:04","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=867"},"modified":"2010-08-25T23:17:04","modified_gmt":"2010-08-25T17:47:04","slug":"textbox-button-anonymous-actionlistener","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/java\/textbox-button-anonymous-actionlistener\/","title":{"rendered":"Event Handling using Anonymous Class in Applet"},"content":{"rendered":"<p>We can handle the Event in Applet, AWT or Swing by following three different methods:<\/p>\n<ul>\n<li>Inner Class<\/li>\n<li>Anonymous class<\/li>\n<li>this Pointer<\/li>\n<\/ul>\n<p>In this example, i will show you that how to use Anonymous\u00a0classes to handle the events in Applet.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage com.kunal.applet;\n\nimport java.applet.Applet;\nimport java.awt.Button;\nimport java.awt.TextField;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\npublic class AnonymouseButton extends Applet {\n\n  TextField txtSource;\n  Button btnToLOwer;\n\n  public void init()\n  {\n     txtSource=new TextField(20);\n     btnToLOwer=new Button(&quot;Lower Case&quot;);\n     btnToLOwer.addActionListener(new ActionListener(){\n\n       @Override\n       public void actionPerformed(ActionEvent e) {\n\n       String tmp=txtSource.getText();\n       tmp=tmp.toLowerCase();\n       txtSource.setText(tmp);\n\n     }});\n\n    add(txtSource);\n    add(btnToLOwer);\n  }\n }\n<\/pre>\n<p><a href=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/08\/AnonymousClass1.jpeg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-891\" title=\"Event Handling using Anonymous Class in Applet \" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/08\/AnonymousClass1.jpeg?resize=212%2C281&#038;ssl=1\" alt=\"Event Handling using Anonymous Class in Applet \" width=\"212\" height=\"281\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source code to demonstrate the usage of anonymous class in 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_post_was_ever_published":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":""},"categories":[3],"tags":[41,92,329],"class_list":["post-867","post","type-post","status-publish","format-standard","hentry","category-java","tag-applet","tag-event-handling","tag-java"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":862,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/textbox-button-anonymous-actionlistner\/","url_meta":{"origin":867,"position":0},"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":847,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/mouse-handling-in-applets-using-this\/","url_meta":{"origin":867,"position":1},"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":778,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/applet-lifecycle-of-applet\/","url_meta":{"origin":867,"position":2},"title":"Lifecycle of Applet","author":"Jitendra","date":"August 22, 2010","format":false,"excerpt":"Example which shows the lifecycle of applet","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":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":867,"position":3},"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":1764,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/read-xml-file-using-sax-parser-in-java\/","url_meta":{"origin":867,"position":4},"title":"Read XML File using SAX Parser in JAVA","author":"Jitendra","date":"March 22, 2011","format":false,"excerpt":"Example of Reading XML File using SAX Parser in JAVA","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/"},"img":{"alt_text":"SAX Parser","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/03\/SAX-Parser.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1571,"url":"https:\/\/www.jitendrazaa.com\/blog\/java\/snmp\/create-snmp-client-in-java-using-snmp4j\/","url_meta":{"origin":867,"position":5},"title":"Create SNMP Client in JAVA Using SNMP4j","author":"Jitendra","date":"February 23, 2011","format":false,"excerpt":"Create SNMP Client in JAVA Using SNMP4j","rel":"","context":"In &quot;SNMP&quot;","block_context":{"text":"SNMP","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/java\/snmp\/"},"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\/867","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=867"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/867\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}