{"id":26791,"date":"2021-05-01T23:10:06","date_gmt":"2021-05-02T03:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/simplifies-the-setting-of-native-look-and-feel-programming-code-examples-java-j2ee-j2me-layout-managers\/"},"modified":"2021-05-01T23:10:06","modified_gmt":"2021-05-02T03:10:06","slug":"simplifies-the-setting-of-native-look-and-feel-programming-code-examples-java-j2ee-j2me-layout-managers","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26791","title":{"rendered":"Simplifies the setting of native look and feel #Programming Code Examples #Java\/J2EE\/J2ME #Layout Managers"},"content":{"rendered":"<pre>\nWindowUtilities.java Simplifies the setting of native look and feel. \n####################\nimport javax.swing.*;\nimport java.awt.*;   \/\/ For Color and Container classes.\n\n\/** A few utilities that simplify using windows in Swing. \n *\n###################\n\npublic class WindowUtilities {\n\n  \/** Tell system to use native look and feel, as in previous\n   *  releases. Metal (Java) LAF is the default otherwise.\n   *\/\n\n  public static void setNativeLookAndFeel() {\n    try {\n     UIManager.setLookAndFeel(\n       UIManager.getSystemLookAndFeelClassName());\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting native LAF: &quot; + e);\n    }\n  }\n\n  public static void setJavaLookAndFeel() {\n    try {\n     UIManager.setLookAndFeel(\n       UIManager.getCrossPlatformLookAndFeelClassName());\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting Java LAF: &quot; + e);\n    }\n  }\n\n   public static void setMotifLookAndFeel() {\n    try {\n      UIManager.setLookAndFeel(\n        &quot;com.sun.java.swing.plaf.motif.MotifLookAndFeel&quot;);\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting Motif LAF: &quot; + e);\n    }\n  }\n\n  \/** A simplified way to see a JPanel or other Container. Pops\n   *  up a JFrame with specified Container as the content pane.\n   *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height,\n                                    String title,\n                                    Color bgColor) {\n    JFrame frame = new JFrame(title);\n    frame.setBackground(bgColor);\n    content.setBackground(bgColor);\n    frame.setSize(width, height);\n    frame.setContentPane(content);\n    frame.addWindowListener(new ExitListener());\n    frame.setVisible(true);\n    return(frame);\n  }\n\n  \/** Uses Color.white as the background color. *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height,\n                                    String title) {\n    return(openInJFrame(content, width, height,\n                        title, Color.white));\n  }\n\n  \/** Uses Color.white as the background color, and the\n   *  name of the Container's class as the JFrame title.\n   *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height) {\n    return(openInJFrame(content, width, height,\n                        content.getClass().getName(),\n                        Color.white));\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=10355<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Layout Managers<br \/>Tags:Java\/J2EE\/J2MELayout Managers<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>WindowUtilities.java Simplifies the setting of native look and feel. #################### import javax.swing.*; import java.awt.*; \/\/ For Color and Container classes. \/** A few utilities that simplify using windows in Swing. * ################### public class WindowUtilities { \/** Tell system to use native look and feel, as in previous * releases. Metal (Java) LAF is the &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26791\">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-26791","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":10323,"url":"http:\/\/bangla.sitestree.com\/?p=10323","url_meta":{"origin":26791,"position":0},"title":"Simplifies the setting of native look and feel","author":"","date":"August 26, 2015","format":false,"excerpt":"WindowUtilities.java Simplifies the setting of native look and feel. #################### import javax.swing.*; import java.awt.*;\u00a0\u00a0 \/\/ For Color and Container classes. \/** A few utilities that simplify using windows in Swing. \u00a0* ################### public class WindowUtilities { \u00a0 \/** Tell system to use native look and feel, as in previous \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":10146,"url":"http:\/\/bangla.sitestree.com\/?p=10146","url_meta":{"origin":26791,"position":1},"title":"PluginApplet.jsp Page that demonstrates the use of jsp:plugin.","author":"","date":"August 12, 2015","format":false,"excerpt":"PluginApplet.jsp\u00a0 Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java\u00a0 Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where\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":26818,"url":"http:\/\/bangla.sitestree.com\/?p=26818","url_meta":{"origin":26791,"position":2},"title":"PluginApplet.jsp  Page that demonstrates the use of jsp:plugin. #Programming Code Examples #Java\/J2EE\/J2ME #JSP","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"PluginApplet.jsp Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where\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":10198,"url":"http:\/\/bangla.sitestree.com\/?p=10198","url_meta":{"origin":26791,"position":3},"title":"WebClient &#8211; Client application that can talk interactively to Web servers. Requires the components listed below","author":"","date":"August 25, 2015","format":false,"excerpt":"import java.awt.*; \/\/ For BorderLayout, GridLayout, Font, Color. import java.awt.event.*; import java.util.*; import javax.swing.*; \/** A graphical client that lets you interactively connect to \u00a0*\u00a0 Web servers and send custom request lines and \u00a0*\u00a0 request headers. \u00a0* \u00a0*\u00a0 Taken from Core Web Programming from \u00a0*\u00a0 Prentice Hall and Sun Microsystems\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":10245,"url":"http:\/\/bangla.sitestree.com\/?p=10245","url_meta":{"origin":26791,"position":4},"title":"DOM example that represents the basic structure of an XML document as a JTree","author":"","date":"August 25, 2015","format":false,"excerpt":"\/\/XMLTree.java \/\/Uses the following files Uses the following files: \u00a0\u00a0\u00a0 * XMLFrame.java:Swing application to select an XML document and display in a JTree. ExtensionFileFilter.java Allows you to specify which file extensions will be displayed in a JFileChooser. test.xml Default file loaded if none selected by user. perennials.xml and perennials.dtd Data\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":26597,"url":"http:\/\/bangla.sitestree.com\/?p=26597","url_meta":{"origin":26791,"position":5},"title":"WebClient &#8211; Client application that can talk interactively to Web servers. Requires the components listed below #Programming Code Examples #Java\/J2EE\/J2ME #Network Programming","author":"Author-Check- Article-or-Video","date":"April 29, 2021","format":false,"excerpt":"WebClient - Client application that can talk interactively to Web servers. Requires the components listed below import java.awt.*; \/\/ For BorderLayout, GridLayout, Font, Color. import java.awt.event.*; import java.util.*; import javax.swing.*; \/** A graphical client that lets you interactively connect to * Web servers and send custom request lines and *\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\/26791","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=26791"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26791\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26791"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}