{"id":27050,"date":"2021-05-09T23:10:05","date_gmt":"2021-05-10T03:10:05","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/reverselabels-java-inherits-from-closeableframe-java-and-uses-reversiblelabel-java-programming-code-examples-java-j2ee-j2me-awt-components\/"},"modified":"2021-05-09T23:10:05","modified_gmt":"2021-05-10T03:10:05","slug":"reverselabels-java-inherits-from-closeableframe-java-and-uses-reversiblelabel-java-programming-code-examples-java-j2ee-j2me-awt-components","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=27050","title":{"rendered":"ReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java. #Programming Code Examples #Java\/J2EE\/J2ME #AWT Components"},"content":{"rendered":"<pre>\nReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java. \n**********************\nReverseLabels.java \n**********************\nimport java.awt.*;\n\n******************\n\npublic class ReverseLabels extends CloseableFrame {\n  public static void main(String[] args) {\n    new ReverseLabels();\n  }\n\n  public ReverseLabels() {\n    super(&quot;Reversible Labels&quot;);\n    setLayout(new FlowLayout());\n    setBackground(Color.lightGray);\n    setFont(new Font(&quot;Serif&quot;, Font.BOLD, 18));\n    ReversibleLabel label1 =\n      new ReversibleLabel(&quot;Black on White&quot;,\n                          Color.white, Color.black);\n    add(label1);\n    ReversibleLabel label2 =\n      new ReversibleLabel(&quot;White on Black&quot;,\n                          Color.black, Color.white);\n    add(label2);\n    pack();\n    setVisible(true);\n  }\n}\n\/.\/.\/.\/.\/.\/.\/.\/.\/.\/.\nCloseableFrame.java \n&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;\nimport java.awt.*;\nimport java.awt.event.*;\n\n\/** A Frame that you can actually quit. Used as the starting \n *  point for most Java 1.1 graphical applications.\n *\n *******************\n *\/\n\npublic class CloseableFrame extends Frame {\n  public CloseableFrame(String title) {\n    super(title);\n    enableEvents(AWTEvent.WINDOW_EVENT_MASK);\n  }\n\n  \/** Since we are doing something permanent, we need\n   *  to call super.processWindowEvent <b>first<\/b>.\n   *\/\n  \n  public void processWindowEvent(WindowEvent event) {\n    super.processWindowEvent(event); \/\/ Handle listeners.\n    if (event.getID() == WindowEvent.WINDOW_CLOSING) {\n      \/\/ If the frame is used in an applet, use dispose().\n      System.exit(0);\n    }\n  }\n}\n&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;\nReversibleLabel.java. \n&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;\nimport java.awt.*;\nimport java.awt.event.*;\n\n\/** A Label that reverses its background and\n *  foreground colors when the mouse is over it.\n *\n **********************\n \npublic class ReversibleLabel extends Label {\n  public ReversibleLabel(String text,\n                         Color bgColor, Color fgColor) {\n    super(text);\n    MouseAdapter reverser = new MouseAdapter() {\n      public void mouseEntered(MouseEvent event) {\n        reverseColors();\n      }\n\n      public void mouseExited(MouseEvent event) {\n        reverseColors(); \/\/ or mouseEntered(event);\n      }\n    };\n    addMouseListener(reverser);\n    setText(text);\n    setBackground(bgColor);\n    setForeground(fgColor);\n  }\n\n  protected void reverseColors() {\n    Color fg = getForeground();\n    Color bg = getBackground();\n    setForeground(bg);\n    setBackground(fg);\n  }\n}\n#############################\n<\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10343<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, AWT Components<br \/>Tags:Java\/J2EE\/J2MEAWT Components<br \/> Post Data:2017-01-02 16:04:35<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java. ********************** ReverseLabels.java ********************** import java.awt.*; ****************** public class ReverseLabels extends CloseableFrame { public static void main(String[] args) { new ReverseLabels(); } public ReverseLabels() { super(&quot;Reversible Labels&quot;); setLayout(new FlowLayout()); setBackground(Color.lightGray); setFont(new Font(&quot;Serif&quot;, Font.BOLD, 18)); ReversibleLabel label1 = new ReversibleLabel(&quot;Black on White&quot;, Color.white, Color.black); add(label1); ReversibleLabel label2 = new ReversibleLabel(&quot;White &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=27050\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-27050","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10363,"url":"http:\/\/bangla.sitestree.com\/?p=10363","url_meta":{"origin":27050,"position":0},"title":"ReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java.","author":"","date":"August 27, 2015","format":false,"excerpt":"ReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java. ********************** ReverseLabels.java ********************** import java.awt.*; ****************** public class ReverseLabels extends CloseableFrame { \u00a0 public static void main(String[] args) { \u00a0\u00a0\u00a0 new ReverseLabels(); \u00a0 } \u00a0 public ReverseLabels() { \u00a0\u00a0\u00a0 super(\"Reversible Labels\"); \u00a0\u00a0\u00a0 setLayout(new FlowLayout()); \u00a0\u00a0\u00a0 setBackground(Color.lightGray); \u00a0\u00a0\u00a0 setFont(new Font(\"Serif\", Font.BOLD, 18)); \u00a0\u00a0\u00a0 ReversibleLabel\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10485,"url":"http:\/\/bangla.sitestree.com\/?p=10485","url_meta":{"origin":27050,"position":1},"title":"HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document","author":"","date":"August 29, 2015","format":false,"excerpt":"HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document (PARAM element containing a NAME-VALUE pair). &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& import java.applet.Applet; import java.awt.*; ************************* public class HelloWWW2 extends Applet { \u00a0 public void init() { \u00a0\u00a0\u00a0 setFont(new Font(\"SansSerif\", Font.BOLD, 30)); \u00a0\u00a0\u00a0 Color background = Color.gray; \u00a0\u00a0\u00a0 Color\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10345,"url":"http:\/\/bangla.sitestree.com\/?p=10345","url_meta":{"origin":27050,"position":2},"title":"Handling Events","author":"","date":"August 27, 2015","format":false,"excerpt":"***********************************\u00a0\u00a0 \u00a0 * ActionExample1.java Inherits from CloseableFrame.java and uses SetSizeButton.java. \u00a0\u00a0\u00a0 * ActionExample2.java Inherits from CloseableFrame.java. \u00a0\u00a0\u00a0 ********************************************************** ActionExample1.java ******************* import java.awt.*; public class ActionExample1 extends CloseableFrame { \u00a0 public static void main(String[] args) { \u00a0\u00a0\u00a0 new ActionExample1(); \u00a0 } \u00a0 public ActionExample1() { \u00a0\u00a0\u00a0 super(\"Handling Events in Component\"); \u00a0\u00a0\u00a0\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27150,"url":"http:\/\/bangla.sitestree.com\/?p=27150","url_meta":{"origin":27050,"position":3},"title":"HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document #Programming Code Examples #Java\/J2EE\/J2ME #Applets and Basic Graphics","author":"Author-Check- Article-or-Video","date":"May 12, 2021","format":false,"excerpt":"HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document (PARAM element containing a NAME-VALUE pair). &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& import java.applet.Applet; import java.awt.*; ************************* public class HelloWWW2 extends Applet { public void init() { setFont(new Font(\"SansSerif\", Font.BOLD, 30)); Color background = Color.gray; Color foreground = Color.darkGray; String\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10325,"url":"http:\/\/bangla.sitestree.com\/?p=10325","url_meta":{"origin":27050,"position":4},"title":"Insert three circles into an Applet using FlowLayout","author":"","date":"August 26, 2015","format":false,"excerpt":"import java.awt.*; import java.applet.Applet; \/** Insert three circles into an Applet using FlowLayout. \u00a0* \u00a0*\/ public class CircleTest extends Applet { \u00a0 public void init() { \u00a0\u00a0\u00a0 setBackground(Color.lightGray); \u00a0\u00a0\u00a0 add(new Circle(Color.white, 30)); \u00a0\u00a0\u00a0 add(new Circle(Color.gray, 40)); \u00a0\u00a0\u00a0 add(new Circle(Color.black, 50)); \u00a0 } }","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27022,"url":"http:\/\/bangla.sitestree.com\/?p=27022","url_meta":{"origin":27050,"position":5},"title":"Handling Events #Programming Code Examples #Java\/J2EE\/J2ME #AWT Components","author":"Author-Check- Article-or-Video","date":"May 8, 2021","format":false,"excerpt":"*********************************** * ActionExample1.java Inherits from CloseableFrame.java and uses SetSizeButton.java. * ActionExample2.java Inherits from CloseableFrame.java. ********************************************************** ActionExample1.java ******************* import java.awt.*; public class ActionExample1 extends CloseableFrame { public static void main(String[] args) { new ActionExample1(); } public ActionExample1() { super(\"Handling Events in Component\"); setLayout(new FlowLayout()); setFont(new Font(\"Serif\", Font.BOLD, 18)); add(new SetSizeButton(300, 200));\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27050"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27050\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27050"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}