{"id":37803,"date":"2016-06-06T15:00:28","date_gmt":"2016-06-06T12:00:28","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=37803"},"modified":"2016-06-05T13:11:16","modified_gmt":"2016-06-05T10:11:16","slug":"java-swing-form-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/","title":{"rendered":"JAVA Swing Form Example"},"content":{"rendered":"<p>With this example we are going to demonstrate creation of form using JAVA Swing. JAVA provides a huge set of libraries to develop a Graphical User Interface. Swing API is built on top of <i>AWT <\/i> API and are widely being used instead of<i> AWT<\/i> API.<\/p>\n<h2>1. Introduction<\/h2>\n<p>There are few terminologies which are required to know before we proceed.<\/p>\n<ul>\n<li>Container: Can be simply thought as Something which contain or holds the component. For example,<code>JFrame<\/code>, <code> JPanel <\/code>etc. Container has to have some layout which is managed by layout manager. By default <code>JFrame<\/code> has BorderLayout and <code>JPanel<\/code> has Flowlayout.<\/li>\n<li>Component: An element which can be seen on the screen and occupies some space. For example, <code>JTextbox<\/code>, <code>JButton<\/code>, <code>JTextarea<\/code>, <code>JLabel<\/code> etc.<\/li>\n<\/ul>\n<h2>2. JAVA Swing Form Example<\/h2>\n<p>JAVA swing form example shows how to create a form using Eclipse.<\/p>\n<p>This article will focus on creation of form having components such as TextBox, TextArea, Label, RadioButton, Button, CheckBox etc. and also how to handle events if generated by a particular component.<\/p>\n<h3>2.1. Setup<\/h3>\n<p><b>Prerequisite:<\/b><\/p>\n<p>This example is developed on Eclipse therefore a compatible Eclipse IDE is required to be installed on the system.<\/p>\n<p>We also need WindowBuilder tool to be installed on Eclipse IDE for the easiness of the work.<br \/>\nFollowing Steps are required to install the WindowBuilder tool.<\/p>\n<ul>\n<li>Go to <b>Eclipse \u2192Help\u2192 Install New Software<\/b><\/li>\n<\/ul>\n<p><figure id=\"attachment_37938\" aria-describedby=\"caption-attachment-37938\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-2-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37938\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-2-1.jpg\" alt=\"Installing WindowBuilder Tool\" width=\"860\" height=\"678\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-2-1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-2-1-300x237.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-2-1-768x605.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37938\" class=\"wp-caption-text\">Installing WindowBuilder Tool<\/figcaption><\/figure><\/p>\n<ul>\n<li>Select your version of eclipse version\/download\/eclipse.org\/release\/eclipse version, <b>For example, Mars &#8211; http:\/\/download.eclipse.org\/releases\/mars <\/b><\/li>\n<li>Select <b>General purpose tools<\/b> from the dropdown and click next.<\/li>\n<\/ul>\n<p><figure id=\"attachment_37940\" aria-describedby=\"caption-attachment-37940\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-5-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37940\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-5-1.jpg\" alt=\"Installing WindowBuilder Tool\" width=\"860\" height=\"455\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-5-1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-5-1-300x160.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-5-1-768x406.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37940\" class=\"wp-caption-text\">Installing WindowBuilder Tool<\/figcaption><\/figure><\/p>\n<p>This will take some time to install the software, restart eclipse in order to see the changes.<\/p>\n<h3>2.2 Java Swing Form<\/h3>\n<p>Create a new JAVA project lets say swing_1<\/p>\n<ul>\n<ul>\n<li>Go to <b>src\u2192 right click\u2192 New\u2192 Other\u2192 WindowBuilder\u2192 select Swing Designer\u2192 Application Window<\/b><\/li>\n<\/ul>\n<\/ul>\n<p><figure id=\"attachment_37941\" aria-describedby=\"caption-attachment-37941\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-6-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37941\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-6-1.jpg\" alt=\"JAVA Swing Form\" width=\"860\" height=\"572\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-6-1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-6-1-300x200.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-6-1-768x511.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37941\" class=\"wp-caption-text\">JAVA Swing Form<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_37942\" aria-describedby=\"caption-attachment-37942\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-8-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37942\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-8-1.jpg\" alt=\"JAVA Swing Form\" width=\"860\" height=\"500\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-8-1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-8-1-300x174.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-8-1-768x447.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37942\" class=\"wp-caption-text\">JAVA Swing Form<\/figcaption><\/figure><\/p>\n<p>Enter the name of the application(eg. JAVASwingFormExample) and click finish.<\/p>\n<p>This will create <b>JAVASwingFormExample.java<\/b> file and will provide Source and Design tab.<\/p>\n<h2>3 Code<\/h2>\n<p>Source file will look like this. Basically, a Frame is being created here.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>JAVASwingFormExample.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package swing_1;\r\n\r\nimport java.awt.EventQueue;\r\n\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JButton;\r\nimport java.awt.Color;\r\nimport java.awt.event.ActionListener;\r\nimport java.awt.event.ActionEvent;\r\nimport javax.swing.JTextField;\r\nimport javax.swing.JLabel;\r\nimport javax.swing.JTextArea;\r\nimport javax.swing.JRadioButton;\r\nimport javax.swing.JToggleButton;\r\nimport javax.swing.JScrollBar;\r\nimport javax.swing.JComboBox;\r\nimport javax.swing.JCheckBox;\r\n\r\npublic class JAVASwingFormExample{\r\n\r\n\tprivate JFrame frame;\r\n\tprivate JTextField textField;\r\n\tprivate JTextField textField_1;\r\n\tprivate JTextField textField_2;\r\n\r\n\t\/**\r\n\t * Launch the application.\r\n\t *\/\r\n\tpublic static void main(String[] args) {\r\n\t\tEventQueue.invokeLater(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tJAVASwingFormExample window = new JAVASwingFormExample();\r\n\t\t\t\t\twindow.frame.setVisible(true);\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\r\n\t\/**\r\n\t * Create the application.\r\n\t *\/\r\n\tpublic JAVASwingFormExample() {\r\n\t\tinitialize();\r\n\t}\r\n\r\n\t\/**\r\n\t * Initialize the contents of the frame.\r\n\t *\/\r\n\tprivate void initialize() {\r\n\t\tframe = new JFrame();\r\n\t\tframe.setBounds(100, 100, 730, 489);\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tframe.getContentPane().setLayout(null);\r\n\r\n       }\r\n\r\n  }\r\n\r\n<\/pre>\n<p><code>EventQueue.invokeLater(new Runnable())<\/code> is an Event-Dispatch thread where events are fired and handled.<br \/>\nDesign tab will look like the one below. Components from the pallet can be added to the frame and the code for the following gets amended in the source file.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><figure id=\"attachment_37943\" aria-describedby=\"caption-attachment-37943\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-10_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37943\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-10_1.jpg\" alt=\"Creating Form\" width=\"860\" height=\"449\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-10_1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-10_1-300x157.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-10_1-768x401.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37943\" class=\"wp-caption-text\">Creating Form<\/figcaption><\/figure><\/p>\n<p>In this example a simple form is being created.To create a form consider the following scenario, ask user to enter his\/her name, phone number, Email id, Address, Gender and Occupation.<br \/>\nAll the fields are mandatory and data will be submitted if all the entries are filled by user, a message will be displayed, i.e, data submitted if user has entered the data correctly or data missing will be displayed. A user can reset the field and can re-enter the data anytime by using clear button.<\/p>\n<p>To begin with, we need 3 textfield, 1 textarea, 8 labels and 2 buttons, 2 radio buttons and combo box.<\/p>\n<p>Before adding any component to the window frame a layout for the frame needs to be selected. In this example Absolute Layout is being set as a layout, you can try and explore all other layouts and can feel the difference.<\/p>\n<p>Click on Absolute Layout and then click on the frame.<br \/>\nClick on the component such as,<code> Jlabel<\/code>,<code>Jtextfield<\/code> etc. and then click in the window frame as shown. Components can be placed anywhere in the container.<\/p>\n<p>Similarly other fields such as, Phone number, Email ID etc will be added.<\/p>\n<p>Source and Design will look like the one below.<\/p>\n<p><figure id=\"attachment_37944\" aria-describedby=\"caption-attachment-37944\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-12_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37944\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-12_1.jpg\" alt=\"Adding component\" width=\"860\" height=\"450\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-12_1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-12_1-300x157.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-12_1-768x402.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37944\" class=\"wp-caption-text\">Adding component<\/figcaption><\/figure><\/p>\n<p><span style=\"text-decoration: underline;\"><em>JAVASwingFormExample.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\t\t\r\ntextField = new JTextField();\r\n\t\ttextField.setBounds(128, 28, 86, 20);\r\n\t\tframe.getContentPane().add(textField);\r\n\t\ttextField.setColumns(10);\r\n\t\t\r\n\t\tJLabel lblName = new JLabel(\"Name\");\r\n\t\tlblName.setBounds(65, 31, 46, 14);\r\n\t\tframe.getContentPane().add(lblName);\r\n\r\n<\/pre>\n<p>Similarly, we will add other fields such as, Phone number, Email ID, Address, Gender and Occupation.<br \/>\nHere is how Design and Source file will look like.<\/p>\n<p><figure id=\"attachment_37945\" aria-describedby=\"caption-attachment-37945\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-17_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37945\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-17_1.jpg\" alt=\"Creating Form\" width=\"860\" height=\"443\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-17_1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-17_1-300x155.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-17_1-768x396.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37945\" class=\"wp-caption-text\">Creating Form<\/figcaption><\/figure><\/p>\n<p><span style=\"text-decoration: underline;\"><em>JAVASwingFormExample.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">\tJLabel lblPhone = new JLabel(\"Phone #\");\r\n\t\tlblPhone.setBounds(65, 68, 46, 14);\r\n\t\tframe.getContentPane().add(lblPhone);\r\n\t\t\r\n\t\ttextField_1 = new JTextField();\r\n\t\ttextField_1.setBounds(128, 65, 86, 20);\r\n\t\tframe.getContentPane().add(textField_1);\r\n\t\ttextField_1.setColumns(10);\r\n\t\t\r\n\t\tJLabel lblEmailId = new JLabel(\"Email Id\");\r\n\t\tlblEmailId.setBounds(65, 115, 46, 14);\r\n\t\tframe.getContentPane().add(lblEmailId);\r\n\t\t\r\n\t\ttextField_2 = new JTextField();\r\n\t\ttextField_2.setBounds(128, 112, 247, 17);\r\n\t\tframe.getContentPane().add(textField_2);\r\n\t\ttextField_2.setColumns(10);\r\n\t\t\r\n\t\tJLabel lblAddress = new JLabel(\"Address\");\r\n\t\tlblAddress.setBounds(65, 162, 46, 14);\r\n\t\tframe.getContentPane().add(lblAddress);\r\n\t\t\t\t\r\n\t\tJTextArea textArea_1 = new JTextArea();\r\n\t\ttextArea_1.setBounds(126, 157, 212, 40);\r\n\t\tframe.getContentPane().add(textArea_1);\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tJButton btnClear = new JButton(\"Clear\");\r\n\t\t\r\n\t\tbtnClear.setBounds(312, 387, 89, 23);\r\n\t\tframe.getContentPane().add(btnClear);\r\n\t\t\r\n\t\tJLabel lblSex = new JLabel(\"Sex\");\r\n\t\tlblSex.setBounds(65, 228, 46, 14);\r\n\t\tframe.getContentPane().add(lblSex);\r\n\t\t\r\n\t\tJLabel lblMale = new JLabel(\"Male\");\r\n\t\tlblMale.setBounds(128, 228, 46, 14);\r\n\t\tframe.getContentPane().add(lblMale);\r\n\t\t\r\n\t\tJLabel lblFemale = new JLabel(\"Female\");\r\n\t\tlblFemale.setBounds(292, 228, 46, 14);\r\n\t\tframe.getContentPane().add(lblFemale);\r\n\t\t\r\n\t\tJRadioButton radioButton = new JRadioButton(\"\");\r\n\t\tradioButton.setBounds(337, 224, 109, 23);\r\n\t\tframe.getContentPane().add(radioButton);\r\n\t\t\r\n\t\tJRadioButton radioButton_1 = new JRadioButton(\"\");\r\n\t\tradioButton_1.setBounds(162, 224, 109, 23);\r\n\t\tframe.getContentPane().add(radioButton_1);\r\n\t\t\r\n\t\tJLabel lblOccupation = new JLabel(\"Occupation\");\r\n\t\tlblOccupation.setBounds(65, 288, 67, 14);\r\n\t\tframe.getContentPane().add(lblOccupation);\r\n\t\t\r\n\t\tJComboBox comboBox = new JComboBox();\r\n\t\tcomboBox.addItem(\"Select\");\r\n\t\tcomboBox.addItem(\"Business\");\r\n\t\tcomboBox.addItem(\"Engineer\");\r\n\t\tcomboBox.addItem(\"Doctor\");\r\n\t\tcomboBox.addItem(\"Student\");\r\n\t\tcomboBox.addItem(\"Others\");\r\n\t\tcomboBox.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t}\r\n\t\t});\r\n\t\tcomboBox.setBounds(180, 285, 91, 20);\r\n\t\tframe.getContentPane().add(comboBox);\r\n\t\t\r\n\t\t\r\n\t\tJButton btnSubmit = new JButton(\"submit\");\r\n\t\t\r\n\t\tbtnSubmit.setBackground(Color.BLUE);\r\n\t\tbtnSubmit.setForeground(Color.MAGENTA);\r\n\t\tbtnSubmit.setBounds(65, 387, 89, 23);\r\n\t\tframe.getContentPane().add(btnSubmit);\r\n\r\n    }\r\n\r\n<\/pre>\n<p><code>Frame.getContentPane().add(lblName)<\/code> adds the label to the frame.<\/p>\n<p>We have added 2 buttons in this form, i.e., Submit and Clear. We need to listen whether these components have generated any event. If so an action needs to be performed. The code for doing so is described below.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>JAVASwingFormExample.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">btnSubmit.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\r\n\t\t\t\tif(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&amp;&amp;(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(\"Select\")))\r\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Data Missing\");\r\n\t\t\t\telse\t\t\r\n\t\t\t\tJOptionPane.showMessageDialog(null, \"Data Submitted\");\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t\tbtnClear.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\ttextField_1.setText(null);\r\n\t\t\t\ttextField_2.setText(null);\r\n\t\t\t\ttextField.setText(null);\r\n\t\t\t\ttextArea_1.setText(null);\r\n\t\t\t\tradioButton.setSelected(false);\r\n\t\t\t\tradioButton_1.setSelected(false);\r\n\t\t\t\tcomboBox.setSelectedItem(\"Select\");\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t});\r\n\r\n<\/pre>\n<p>submit button will continuously listen for an event and requires method <code>actionPerformed<\/code> to be implemented in order to take an action if an event is generated. If any of the field is empty submit button will show a message Data Missing or else Data will be Submitted. Similarly, for clear button if any event is generated <code>actionPerformed<\/code> will reset the data to null.<\/p>\n<p>After execution of the code form will look like this:<\/p>\n<p><figure id=\"attachment_37946\" aria-describedby=\"caption-attachment-37946\" style=\"width: 860px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-18-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-37946\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-18-1.jpg\" alt=\"JAVA Swing form\" width=\"860\" height=\"460\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-18-1.jpg 860w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-18-1-300x160.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/Screenshot-18-1-768x411.jpg 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/a><figcaption id=\"caption-attachment-37946\" class=\"wp-caption-text\">JAVA Swing form<\/figcaption><\/figure><\/p>\n<h2>4. Download the Source Code<\/h2>\n<p>This was an example of creation of JAVA Swing form.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/06\/JAVASwingFormExample.zip\"><strong>JAVASwingFormExample<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>With this example we are going to demonstrate creation of form using JAVA Swing. JAVA provides a huge set of libraries to develop a Graphical User Interface. Swing API is built on top of AWT API and are widely being used instead of AWT API. 1. Introduction There are few terminologies which are required to &hellip;<\/p>\n","protected":false},"author":98,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[],"class_list":["post-37803","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JAVA Swing Form Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"package swing_1; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; \/\/import javax.swing.JRadioButton; \/\/import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JScrollBar; import javax.swing.JComboBox; import javax.swing.JCheckBox; public class J2 { private JFrame frame; private JTextField textField; private JTextField textField_1; private JTextField textField_2; \/** * Launch the application. *\/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { J2 window = new J2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } \/** * Create the application. *\/ public J2() { initialize(); } \/** * Initialize the contents of the frame. *\/ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 730, 489); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnSubmit = new JButton(&quot;submit&quot;); btnSubmit.setBackground(Color.BLUE); btnSubmit.setForeground(Color.MAGENTA); btnSubmit.setBounds(65, 387, 89, 23); frame.getContentPane().add(btnSubmit); textField = new JTextField(); textField.setBounds(128, 28, 86, 20); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblName = new JLabel(&quot;Name&quot;); lblName.setBounds(65, 31, 46, 14); frame.getContentPane().add(lblName); JLabel lblPhone = new JLabel(&quot;Phone #&quot;); lblPhone.setBounds(65, 68, 46, 14); frame.getContentPane().add(lblPhone); textField_1 = new JTextField(); textField_1.setBounds(128, 65, 86, 20); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblEmailId = new JLabel(&quot;Email Id&quot;); lblEmailId.setBounds(65, 115, 46, 14); frame.getContentPane().add(lblEmailId); textField_2 = new JTextField(); textField_2.setBounds(128, 112, 247, 17); frame.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblAddress = new JLabel(&quot;Address&quot;); lblAddress.setBounds(65, 162, 46, 14); frame.getContentPane().add(lblAddress); JTextArea textArea_1 = new JTextArea(); textArea_1.setBounds(126, 157, 212, 40); frame.getContentPane().add(textArea_1); JButton btnClear = new JButton(&quot;Clear&quot;); btnClear.setBounds(312, 387, 89, 23); frame.getContentPane().add(btnClear); JLabel lblSex = new JLabel(&quot;Sex&quot;); lblSex.setBounds(65, 228, 46, 14); frame.getContentPane().add(lblSex); JLabel lblMale = new JLabel(&quot;Male&quot;); lblMale.setBounds(128, 228, 46, 14); frame.getContentPane().add(lblMale); JLabel lblFemale = new JLabel(&quot;Female&quot;); lblFemale.setBounds(292, 228, 46, 14); frame.getContentPane().add(lblFemale); JRadioButton radioButton = new JRadioButton(&quot;&quot;); radioButton.setBounds(337, 224, 109, 23); frame.getContentPane().add(radioButton); JRadioButton radioButton_1 = new JRadioButton(&quot;&quot;); radioButton_1.setBounds(162, 224, 109, 23); frame.getContentPane().add(radioButton_1); JLabel lblOccupation = new JLabel(&quot;Occupation&quot;); lblOccupation.setBounds(65, 288, 67, 14); frame.getContentPane().add(lblOccupation); JComboBox comboBox = new JComboBox(); comboBox.addItem(&quot;Select&quot;); comboBox.addItem(&quot;Business&quot;); comboBox.addItem(&quot;Engineer&quot;); comboBox.addItem(&quot;Doctor&quot;); comboBox.addItem(&quot;Student&quot;); comboBox.addItem(&quot;Others&quot;); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); comboBox.setBounds(180, 285, 91, 20); frame.getContentPane().add(comboBox); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&amp;&amp;(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(&quot;Select&quot;))) JOptionPane.showMessageDialog(null, &quot;Data Missing&quot;); else JOptionPane.showMessageDialog(null, &quot;Data Submitted&quot;); } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_1.setText(null); textField_2.setText(null); textField.setText(null); textArea_1.setText(null); radioButton.setSelected(false); radioButton_1.setSelected(false); comboBox.setSelectedItem(&quot;Select&quot;); } }); } }\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JAVA Swing Form Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"package swing_1; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; \/\/import javax.swing.JRadioButton; \/\/import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JScrollBar; import javax.swing.JComboBox; import javax.swing.JCheckBox; public class J2 { private JFrame frame; private JTextField textField; private JTextField textField_1; private JTextField textField_2; \/** * Launch the application. *\/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { J2 window = new J2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } \/** * Create the application. *\/ public J2() { initialize(); } \/** * Initialize the contents of the frame. *\/ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 730, 489); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnSubmit = new JButton(&quot;submit&quot;); btnSubmit.setBackground(Color.BLUE); btnSubmit.setForeground(Color.MAGENTA); btnSubmit.setBounds(65, 387, 89, 23); frame.getContentPane().add(btnSubmit); textField = new JTextField(); textField.setBounds(128, 28, 86, 20); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblName = new JLabel(&quot;Name&quot;); lblName.setBounds(65, 31, 46, 14); frame.getContentPane().add(lblName); JLabel lblPhone = new JLabel(&quot;Phone #&quot;); lblPhone.setBounds(65, 68, 46, 14); frame.getContentPane().add(lblPhone); textField_1 = new JTextField(); textField_1.setBounds(128, 65, 86, 20); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblEmailId = new JLabel(&quot;Email Id&quot;); lblEmailId.setBounds(65, 115, 46, 14); frame.getContentPane().add(lblEmailId); textField_2 = new JTextField(); textField_2.setBounds(128, 112, 247, 17); frame.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblAddress = new JLabel(&quot;Address&quot;); lblAddress.setBounds(65, 162, 46, 14); frame.getContentPane().add(lblAddress); JTextArea textArea_1 = new JTextArea(); textArea_1.setBounds(126, 157, 212, 40); frame.getContentPane().add(textArea_1); JButton btnClear = new JButton(&quot;Clear&quot;); btnClear.setBounds(312, 387, 89, 23); frame.getContentPane().add(btnClear); JLabel lblSex = new JLabel(&quot;Sex&quot;); lblSex.setBounds(65, 228, 46, 14); frame.getContentPane().add(lblSex); JLabel lblMale = new JLabel(&quot;Male&quot;); lblMale.setBounds(128, 228, 46, 14); frame.getContentPane().add(lblMale); JLabel lblFemale = new JLabel(&quot;Female&quot;); lblFemale.setBounds(292, 228, 46, 14); frame.getContentPane().add(lblFemale); JRadioButton radioButton = new JRadioButton(&quot;&quot;); radioButton.setBounds(337, 224, 109, 23); frame.getContentPane().add(radioButton); JRadioButton radioButton_1 = new JRadioButton(&quot;&quot;); radioButton_1.setBounds(162, 224, 109, 23); frame.getContentPane().add(radioButton_1); JLabel lblOccupation = new JLabel(&quot;Occupation&quot;); lblOccupation.setBounds(65, 288, 67, 14); frame.getContentPane().add(lblOccupation); JComboBox comboBox = new JComboBox(); comboBox.addItem(&quot;Select&quot;); comboBox.addItem(&quot;Business&quot;); comboBox.addItem(&quot;Engineer&quot;); comboBox.addItem(&quot;Doctor&quot;); comboBox.addItem(&quot;Student&quot;); comboBox.addItem(&quot;Others&quot;); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); comboBox.setBounds(180, 285, 91, 20); frame.getContentPane().add(comboBox); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&amp;&amp;(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(&quot;Select&quot;))) JOptionPane.showMessageDialog(null, &quot;Data Missing&quot;); else JOptionPane.showMessageDialog(null, &quot;Data Submitted&quot;); } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_1.setText(null); textField_2.setText(null); textField.setText(null); textArea_1.setText(null); radioButton.setSelected(false); radioButton_1.setSelected(false); comboBox.setSelectedItem(&quot;Select&quot;); } }); } }\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/jyoti.jha.9256\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-06T12:00:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jyoti Jha\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jyoti Jha\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\"},\"author\":{\"name\":\"Jyoti Jha\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7dcd033e37def0d21806e891845d89b7\"},\"headline\":\"JAVA Swing Form Example\",\"datePublished\":\"2016-06-06T12:00:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\"},\"wordCount\":820,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"articleSection\":[\"swing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\",\"name\":\"JAVA Swing Form Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2016-06-06T12:00:28+00:00\",\"description\":\"package swing_1; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; \/\/import javax.swing.JRadioButton; \/\/import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JScrollBar; import javax.swing.JComboBox; import javax.swing.JCheckBox; public class J2 { private JFrame frame; private JTextField textField; private JTextField textField_1; private JTextField textField_2; \/** * Launch the application. *\/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { J2 window = new J2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } \/** * Create the application. *\/ public J2() { initialize(); } \/** * Initialize the contents of the frame. *\/ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 730, 489); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnSubmit = new JButton(\\\"submit\\\"); btnSubmit.setBackground(Color.BLUE); btnSubmit.setForeground(Color.MAGENTA); btnSubmit.setBounds(65, 387, 89, 23); frame.getContentPane().add(btnSubmit); textField = new JTextField(); textField.setBounds(128, 28, 86, 20); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblName = new JLabel(\\\"Name\\\"); lblName.setBounds(65, 31, 46, 14); frame.getContentPane().add(lblName); JLabel lblPhone = new JLabel(\\\"Phone #\\\"); lblPhone.setBounds(65, 68, 46, 14); frame.getContentPane().add(lblPhone); textField_1 = new JTextField(); textField_1.setBounds(128, 65, 86, 20); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblEmailId = new JLabel(\\\"Email Id\\\"); lblEmailId.setBounds(65, 115, 46, 14); frame.getContentPane().add(lblEmailId); textField_2 = new JTextField(); textField_2.setBounds(128, 112, 247, 17); frame.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblAddress = new JLabel(\\\"Address\\\"); lblAddress.setBounds(65, 162, 46, 14); frame.getContentPane().add(lblAddress); JTextArea textArea_1 = new JTextArea(); textArea_1.setBounds(126, 157, 212, 40); frame.getContentPane().add(textArea_1); JButton btnClear = new JButton(\\\"Clear\\\"); btnClear.setBounds(312, 387, 89, 23); frame.getContentPane().add(btnClear); JLabel lblSex = new JLabel(\\\"Sex\\\"); lblSex.setBounds(65, 228, 46, 14); frame.getContentPane().add(lblSex); JLabel lblMale = new JLabel(\\\"Male\\\"); lblMale.setBounds(128, 228, 46, 14); frame.getContentPane().add(lblMale); JLabel lblFemale = new JLabel(\\\"Female\\\"); lblFemale.setBounds(292, 228, 46, 14); frame.getContentPane().add(lblFemale); JRadioButton radioButton = new JRadioButton(\\\"\\\"); radioButton.setBounds(337, 224, 109, 23); frame.getContentPane().add(radioButton); JRadioButton radioButton_1 = new JRadioButton(\\\"\\\"); radioButton_1.setBounds(162, 224, 109, 23); frame.getContentPane().add(radioButton_1); JLabel lblOccupation = new JLabel(\\\"Occupation\\\"); lblOccupation.setBounds(65, 288, 67, 14); frame.getContentPane().add(lblOccupation); JComboBox comboBox = new JComboBox(); comboBox.addItem(\\\"Select\\\"); comboBox.addItem(\\\"Business\\\"); comboBox.addItem(\\\"Engineer\\\"); comboBox.addItem(\\\"Doctor\\\"); comboBox.addItem(\\\"Student\\\"); comboBox.addItem(\\\"Others\\\"); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); comboBox.setBounds(180, 285, 91, 20); frame.getContentPane().add(comboBox); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&&(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(\\\"Select\\\"))) JOptionPane.showMessageDialog(null, \\\"Data Missing\\\"); else JOptionPane.showMessageDialog(null, \\\"Data Submitted\\\"); } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_1.setText(null); textField_2.setText(null); textField.setText(null); textArea_1.setText(null); radioButton.setSelected(false); radioButton_1.setSelected(false); comboBox.setSelectedItem(\\\"Select\\\"); } }); } }\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Desktop Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/desktop-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"swing\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/desktop-java\/swing\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JAVA Swing Form Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7dcd033e37def0d21806e891845d89b7\",\"name\":\"Jyoti Jha\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/Jyoti-Jha-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/Jyoti-Jha-96x96.jpg\",\"caption\":\"Jyoti Jha\"},\"description\":\"Jyoti is a tech enthusiast and is an avid programmer. She holds a post graduation degree in (M.Tech) Computer Science Engineering from Thapar Univeristy, Patiala, India. Post her graduate studies, she has worked in Software companies such as SLK Software and Aricent, India as Software Engineer in various projects primarily in the field of Requirement analysis and design, implementing new algorithms in C++ and JAVA used in ISDN network and designing databases and. She is inquisitive about socio economic reforms as well as advancement in technical fronts and keep herself informed with TED talks and various blogs.\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\/\",\"https:\/\/www.facebook.com\/jyoti.jha.9256\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/jyoti-jha\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JAVA Swing Form Example - Java Code Geeks","description":"package swing_1; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; \/\/import javax.swing.JRadioButton; \/\/import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JScrollBar; import javax.swing.JComboBox; import javax.swing.JCheckBox; public class J2 { private JFrame frame; private JTextField textField; private JTextField textField_1; private JTextField textField_2; \/** * Launch the application. *\/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { J2 window = new J2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } \/** * Create the application. *\/ public J2() { initialize(); } \/** * Initialize the contents of the frame. *\/ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 730, 489); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnSubmit = new JButton(\"submit\"); btnSubmit.setBackground(Color.BLUE); btnSubmit.setForeground(Color.MAGENTA); btnSubmit.setBounds(65, 387, 89, 23); frame.getContentPane().add(btnSubmit); textField = new JTextField(); textField.setBounds(128, 28, 86, 20); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblName = new JLabel(\"Name\"); lblName.setBounds(65, 31, 46, 14); frame.getContentPane().add(lblName); JLabel lblPhone = new JLabel(\"Phone #\"); lblPhone.setBounds(65, 68, 46, 14); frame.getContentPane().add(lblPhone); textField_1 = new JTextField(); textField_1.setBounds(128, 65, 86, 20); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblEmailId = new JLabel(\"Email Id\"); lblEmailId.setBounds(65, 115, 46, 14); frame.getContentPane().add(lblEmailId); textField_2 = new JTextField(); textField_2.setBounds(128, 112, 247, 17); frame.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblAddress = new JLabel(\"Address\"); lblAddress.setBounds(65, 162, 46, 14); frame.getContentPane().add(lblAddress); JTextArea textArea_1 = new JTextArea(); textArea_1.setBounds(126, 157, 212, 40); frame.getContentPane().add(textArea_1); JButton btnClear = new JButton(\"Clear\"); btnClear.setBounds(312, 387, 89, 23); frame.getContentPane().add(btnClear); JLabel lblSex = new JLabel(\"Sex\"); lblSex.setBounds(65, 228, 46, 14); frame.getContentPane().add(lblSex); JLabel lblMale = new JLabel(\"Male\"); lblMale.setBounds(128, 228, 46, 14); frame.getContentPane().add(lblMale); JLabel lblFemale = new JLabel(\"Female\"); lblFemale.setBounds(292, 228, 46, 14); frame.getContentPane().add(lblFemale); JRadioButton radioButton = new JRadioButton(\"\"); radioButton.setBounds(337, 224, 109, 23); frame.getContentPane().add(radioButton); JRadioButton radioButton_1 = new JRadioButton(\"\"); radioButton_1.setBounds(162, 224, 109, 23); frame.getContentPane().add(radioButton_1); JLabel lblOccupation = new JLabel(\"Occupation\"); lblOccupation.setBounds(65, 288, 67, 14); frame.getContentPane().add(lblOccupation); JComboBox comboBox = new JComboBox(); comboBox.addItem(\"Select\"); comboBox.addItem(\"Business\"); comboBox.addItem(\"Engineer\"); comboBox.addItem(\"Doctor\"); comboBox.addItem(\"Student\"); comboBox.addItem(\"Others\"); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); comboBox.setBounds(180, 285, 91, 20); frame.getContentPane().add(comboBox); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&&(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(\"Select\"))) JOptionPane.showMessageDialog(null, \"Data Missing\"); else JOptionPane.showMessageDialog(null, \"Data Submitted\"); } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_1.setText(null); textField_2.setText(null); textField.setText(null); textArea_1.setText(null); radioButton.setSelected(false); radioButton_1.setSelected(false); comboBox.setSelectedItem(\"Select\"); } }); } }","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/","og_locale":"en_US","og_type":"article","og_title":"JAVA Swing Form Example - Java Code Geeks","og_description":"package swing_1; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; \/\/import javax.swing.JRadioButton; \/\/import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JScrollBar; import javax.swing.JComboBox; import javax.swing.JCheckBox; public class J2 { private JFrame frame; private JTextField textField; private JTextField textField_1; private JTextField textField_2; \/** * Launch the application. *\/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { J2 window = new J2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } \/** * Create the application. *\/ public J2() { initialize(); } \/** * Initialize the contents of the frame. *\/ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 730, 489); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnSubmit = new JButton(\"submit\"); btnSubmit.setBackground(Color.BLUE); btnSubmit.setForeground(Color.MAGENTA); btnSubmit.setBounds(65, 387, 89, 23); frame.getContentPane().add(btnSubmit); textField = new JTextField(); textField.setBounds(128, 28, 86, 20); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblName = new JLabel(\"Name\"); lblName.setBounds(65, 31, 46, 14); frame.getContentPane().add(lblName); JLabel lblPhone = new JLabel(\"Phone #\"); lblPhone.setBounds(65, 68, 46, 14); frame.getContentPane().add(lblPhone); textField_1 = new JTextField(); textField_1.setBounds(128, 65, 86, 20); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblEmailId = new JLabel(\"Email Id\"); lblEmailId.setBounds(65, 115, 46, 14); frame.getContentPane().add(lblEmailId); textField_2 = new JTextField(); textField_2.setBounds(128, 112, 247, 17); frame.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblAddress = new JLabel(\"Address\"); lblAddress.setBounds(65, 162, 46, 14); frame.getContentPane().add(lblAddress); JTextArea textArea_1 = new JTextArea(); textArea_1.setBounds(126, 157, 212, 40); frame.getContentPane().add(textArea_1); JButton btnClear = new JButton(\"Clear\"); btnClear.setBounds(312, 387, 89, 23); frame.getContentPane().add(btnClear); JLabel lblSex = new JLabel(\"Sex\"); lblSex.setBounds(65, 228, 46, 14); frame.getContentPane().add(lblSex); JLabel lblMale = new JLabel(\"Male\"); lblMale.setBounds(128, 228, 46, 14); frame.getContentPane().add(lblMale); JLabel lblFemale = new JLabel(\"Female\"); lblFemale.setBounds(292, 228, 46, 14); frame.getContentPane().add(lblFemale); JRadioButton radioButton = new JRadioButton(\"\"); radioButton.setBounds(337, 224, 109, 23); frame.getContentPane().add(radioButton); JRadioButton radioButton_1 = new JRadioButton(\"\"); radioButton_1.setBounds(162, 224, 109, 23); frame.getContentPane().add(radioButton_1); JLabel lblOccupation = new JLabel(\"Occupation\"); lblOccupation.setBounds(65, 288, 67, 14); frame.getContentPane().add(lblOccupation); JComboBox comboBox = new JComboBox(); comboBox.addItem(\"Select\"); comboBox.addItem(\"Business\"); comboBox.addItem(\"Engineer\"); comboBox.addItem(\"Doctor\"); comboBox.addItem(\"Student\"); comboBox.addItem(\"Others\"); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); comboBox.setBounds(180, 285, 91, 20); frame.getContentPane().add(comboBox); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&&(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(\"Select\"))) JOptionPane.showMessageDialog(null, \"Data Missing\"); else JOptionPane.showMessageDialog(null, \"Data Submitted\"); } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_1.setText(null); textField_2.setText(null); textField.setText(null); textArea_1.setText(null); radioButton.setSelected(false); radioButton_1.setSelected(false); comboBox.setSelectedItem(\"Select\"); } }); } }","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_author":"https:\/\/www.facebook.com\/jyoti.jha.9256","article_published_time":"2016-06-06T12:00:28+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Jyoti Jha","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Jyoti Jha","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/"},"author":{"name":"Jyoti Jha","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7dcd033e37def0d21806e891845d89b7"},"headline":"JAVA Swing Form Example","datePublished":"2016-06-06T12:00:28+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/"},"wordCount":820,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","articleSection":["swing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/","name":"JAVA Swing Form Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2016-06-06T12:00:28+00:00","description":"package swing_1; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JOptionPane; \/\/import javax.swing.JRadioButton; \/\/import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JRadioButton; import javax.swing.JToggleButton; import javax.swing.JScrollBar; import javax.swing.JComboBox; import javax.swing.JCheckBox; public class J2 { private JFrame frame; private JTextField textField; private JTextField textField_1; private JTextField textField_2; \/** * Launch the application. *\/ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { J2 window = new J2(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } \/** * Create the application. *\/ public J2() { initialize(); } \/** * Initialize the contents of the frame. *\/ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 730, 489); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnSubmit = new JButton(\"submit\"); btnSubmit.setBackground(Color.BLUE); btnSubmit.setForeground(Color.MAGENTA); btnSubmit.setBounds(65, 387, 89, 23); frame.getContentPane().add(btnSubmit); textField = new JTextField(); textField.setBounds(128, 28, 86, 20); frame.getContentPane().add(textField); textField.setColumns(10); JLabel lblName = new JLabel(\"Name\"); lblName.setBounds(65, 31, 46, 14); frame.getContentPane().add(lblName); JLabel lblPhone = new JLabel(\"Phone #\"); lblPhone.setBounds(65, 68, 46, 14); frame.getContentPane().add(lblPhone); textField_1 = new JTextField(); textField_1.setBounds(128, 65, 86, 20); frame.getContentPane().add(textField_1); textField_1.setColumns(10); JLabel lblEmailId = new JLabel(\"Email Id\"); lblEmailId.setBounds(65, 115, 46, 14); frame.getContentPane().add(lblEmailId); textField_2 = new JTextField(); textField_2.setBounds(128, 112, 247, 17); frame.getContentPane().add(textField_2); textField_2.setColumns(10); JLabel lblAddress = new JLabel(\"Address\"); lblAddress.setBounds(65, 162, 46, 14); frame.getContentPane().add(lblAddress); JTextArea textArea_1 = new JTextArea(); textArea_1.setBounds(126, 157, 212, 40); frame.getContentPane().add(textArea_1); JButton btnClear = new JButton(\"Clear\"); btnClear.setBounds(312, 387, 89, 23); frame.getContentPane().add(btnClear); JLabel lblSex = new JLabel(\"Sex\"); lblSex.setBounds(65, 228, 46, 14); frame.getContentPane().add(lblSex); JLabel lblMale = new JLabel(\"Male\"); lblMale.setBounds(128, 228, 46, 14); frame.getContentPane().add(lblMale); JLabel lblFemale = new JLabel(\"Female\"); lblFemale.setBounds(292, 228, 46, 14); frame.getContentPane().add(lblFemale); JRadioButton radioButton = new JRadioButton(\"\"); radioButton.setBounds(337, 224, 109, 23); frame.getContentPane().add(radioButton); JRadioButton radioButton_1 = new JRadioButton(\"\"); radioButton_1.setBounds(162, 224, 109, 23); frame.getContentPane().add(radioButton_1); JLabel lblOccupation = new JLabel(\"Occupation\"); lblOccupation.setBounds(65, 288, 67, 14); frame.getContentPane().add(lblOccupation); JComboBox comboBox = new JComboBox(); comboBox.addItem(\"Select\"); comboBox.addItem(\"Business\"); comboBox.addItem(\"Engineer\"); comboBox.addItem(\"Doctor\"); comboBox.addItem(\"Student\"); comboBox.addItem(\"Others\"); comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } }); comboBox.setBounds(180, 285, 91, 20); frame.getContentPane().add(comboBox); btnSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(textField.getText().isEmpty()||(textField_1.getText().isEmpty())||(textField_2.getText().isEmpty())||(textArea_1.getText().isEmpty())||((radioButton_1.isSelected())&&(radioButton.isSelected()))||(comboBox.getSelectedItem().equals(\"Select\"))) JOptionPane.showMessageDialog(null, \"Data Missing\"); else JOptionPane.showMessageDialog(null, \"Data Submitted\"); } }); btnClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { textField_1.setText(null); textField_2.setText(null); textField.setText(null); textArea_1.setText(null); radioButton.setSelected(false); radioButton_1.setSelected(false); comboBox.setSelectedItem(\"Select\"); } }); } }","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/desktop-java\/swing\/java-swing-form-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Desktop Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/desktop-java\/"},{"@type":"ListItem","position":4,"name":"swing","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/desktop-java\/swing\/"},{"@type":"ListItem","position":5,"name":"JAVA Swing Form Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/7dcd033e37def0d21806e891845d89b7","name":"Jyoti Jha","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/Jyoti-Jha-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/05\/Jyoti-Jha-96x96.jpg","caption":"Jyoti Jha"},"description":"Jyoti is a tech enthusiast and is an avid programmer. She holds a post graduation degree in (M.Tech) Computer Science Engineering from Thapar Univeristy, Patiala, India. Post her graduate studies, she has worked in Software companies such as SLK Software and Aricent, India as Software Engineer in various projects primarily in the field of Requirement analysis and design, implementing new algorithms in C++ and JAVA used in ISDN network and designing databases and. She is inquisitive about socio economic reforms as well as advancement in technical fronts and keep herself informed with TED talks and various blogs.","sameAs":["https:\/\/www.javacodegeeks.com\/","https:\/\/www.facebook.com\/jyoti.jha.9256"],"url":"https:\/\/examples.javacodegeeks.com\/author\/jyoti-jha\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/37803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/98"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=37803"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/37803\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=37803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=37803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=37803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}