{"id":10275,"date":"2015-08-26T00:00:43","date_gmt":"2015-08-26T04:00:43","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/?p=10275"},"modified":"2015-08-24T08:47:23","modified_gmt":"2015-08-24T12:47:23","slug":"creating-a-simple-swing-application-using-a-jframe","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=10275","title":{"rendered":"creating a simple Swing application using a JFrame"},"content":{"rendered":"<p style=\"text-align: justify;\">JFrameExample.java Demonstrates creating a simple Swing application using a JFrame. As with a JApplet, components must be added to the content pane, instead of the window directly.import java.awt.*;<\/p>\n<pre>\r\nimport javax.swing.*;\r\n\r\n\/** Tiny example showing the main difference in using \r\n\u00a0*\u00a0 JFrame instead of Frame: using the content pane\r\n\u00a0*\u00a0 and getting the Java (Metal) look and feel by default\r\n\u00a0*\u00a0 instead of the native look and feel.\r\n\u00a0*\r\n\u00a0*\/\r\n\r\npublic class JFrameExample {\r\n\u00a0 public static void main(String[] args) {\r\n\u00a0\u00a0\u00a0 WindowUtilities.setNativeLookAndFeel();\r\n\u00a0\u00a0\u00a0 JFrame f = new JFrame(\"This is a test\");\r\n\u00a0\u00a0\u00a0 f.setSize(400, 150);\r\n\u00a0\u00a0\u00a0 Container content = f.getContentPane();\r\n\u00a0\u00a0\u00a0 content.setBackground(Color.white);\r\n\u00a0\u00a0\u00a0 content.setLayout(new FlowLayout()); \r\n\u00a0\u00a0\u00a0 content.add(new JButton(\"Button 1\"));\r\n\u00a0\u00a0\u00a0 content.add(new JButton(\"Button 2\"));\r\n\u00a0\u00a0\u00a0 content.add(new JButton(\"Button 3\"));\r\n\u00a0\u00a0\u00a0 f.addWindowListener(new ExitListener());\r\n\u00a0\u00a0\u00a0 f.setVisible(true);\r\n\u00a0 }\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>JFrameExample.java Demonstrates creating a simple Swing application using a JFrame. As with a JApplet, components must be added to the content pane, instead of the window directly.import java.awt.*; import javax.swing.*; \/** Tiny example showing the main difference in using \u00a0*\u00a0 JFrame instead of Frame: using the content pane \u00a0*\u00a0 and getting the Java (Metal) look &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=10275\">Continue reading<\/a><\/p>\n","protected":false},"author":130,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1417,1424],"tags":[706,308,285],"class_list":["post-10275","post","type-post","status-publish","format-standard","hentry","category-code-programming-samples--","category-javaj2eej2me","tag-code","tag-java","tag-285","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":27211,"url":"http:\/\/bangla.sitestree.com\/?p=27211","url_meta":{"origin":10275,"position":0},"title":"creating a simple Swing application using a JFrame #Programming Code Examples #Java\/J2EE\/J2ME #Advanced Swing","author":"Author-Check- Article-or-Video","date":"May 14, 2021","format":false,"excerpt":"JFrameExample.java Demonstrates creating a simple Swing application using a JFrame. As with a JApplet, components must be added to the content pane, instead of the window directly.import java.awt.*; import javax.swing.*; \/** Tiny example showing the main difference in using * JFrame instead of Frame: using the content pane * 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":[]},{"id":10323,"url":"http:\/\/bangla.sitestree.com\/?p=10323","url_meta":{"origin":10275,"position":1},"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":26791,"url":"http:\/\/bangla.sitestree.com\/?p=26791","url_meta":{"origin":10275,"position":2},"title":"Simplifies the setting of native look and feel #Programming Code Examples #Java\/J2EE\/J2ME #Layout Managers","author":"Author-Check- Article-or-Video","date":"May 1, 2021","format":false,"excerpt":"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.\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":10146,"url":"http:\/\/bangla.sitestree.com\/?p=10146","url_meta":{"origin":10275,"position":3},"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":10275,"position":4},"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":10245,"url":"http:\/\/bangla.sitestree.com\/?p=10245","url_meta":{"origin":10275,"position":5},"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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10275","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\/130"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10275"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10275\/revisions"}],"predecessor-version":[{"id":10276,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/10275\/revisions\/10276"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10275"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}