{"id":368,"date":"2016-11-27T18:47:29","date_gmt":"2016-11-27T18:47:29","guid":{"rendered":"http:\/\/sindhitutorials.com\/blog\/?p=368"},"modified":"2018-10-13T17:03:12","modified_gmt":"2018-10-13T17:03:12","slug":"chat-messenger-java-project-code","status":"publish","type":"post","link":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/","title":{"rendered":"Chat Messenger Java Project Code"},"content":{"rendered":"<h1>Chat Messenger Java Project Code<\/h1>\n<p>The Project &#8220;Chat Messenger Java Project Code&#8221; is an example of Java Chat App. If you are a student or Java Beginner and want to learn how to develop Chat Messenger in Java, here It is &#8220;Chat Messenger Java Project Code&#8221; for you. It is very simple project to learn. I&#8217;ll try to tell you all details\u00a0about Chat Messenger Java Project Code.<\/p>\n<h2>APIs used in this Project<\/h2>\n<ul>\n<li>\n<h3>Swing<\/h3>\n<\/li>\n<li>\n<h3>AWT<\/h3>\n<\/li>\n<li>\n<h3>IO and NET<\/h3>\n<\/li>\n<\/ul>\n<blockquote><p>So using these APIs we are going to develop project. This Project contains two way communication like &#8220;Sever &#8211; to &#8211; \u00a0Client&#8221; and &#8220;Client &#8211; to &#8211; Server&#8221; Chat. For the Server Client chat purpose I&#8217;m using socket programming for communication between two applications.<\/p><\/blockquote>\n<h2>Socket Programming<\/h2>\n<p>A Socket is a computer network programming technology, It is a link between two running programs over the network.<\/p>\n<p><strong>Server:\u00a0<\/strong>A server is an application, which runs on specific computer and has a socket that is bound to port.\u00a0It waits and listens to socket on specific\u00a0address and port number.<\/p>\n<p><strong>Client:\u00a0<\/strong>A client is also an application. It knows the host-name of the server and the port number on which server is listening.<\/p>\n<h2>Sever App Development in &#8220;Chat Messenger Java Project Code project&#8221;<\/h2>\n<h4>UserName Input Screen in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<figure id=\"attachment_344\" aria-describedby=\"caption-attachment-344\" style=\"width: 293px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-344\" src=\"http:\/\/localhost\/blog\/wp-content\/uploads\/2016\/11\/Input_UserName_Server.jpg\" alt=\"Input User Name Server\" width=\"293\" height=\"123\" \/><figcaption id=\"caption-attachment-344\" class=\"wp-caption-text\">It takes User Name input for Server App<\/figcaption><\/figure>\n<blockquote><p>It takes input for User Name for the Server App. It will be shown to the Client App while chatting.<\/p><\/blockquote>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nuserName = JOptionPane.showInputDialog(&quot;User Name (Server)&quot;);\r\n<\/pre>\n<h4>Console shows IP address in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<figure id=\"attachment_350\" aria-describedby=\"caption-attachment-350\" style=\"width: 1022px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-350 size-full\" src=\"http:\/\/localhost\/blog\/wp-content\/uploads\/2016\/11\/console_ip.jpg\" alt=\"Ip Address in Console\" width=\"1022\" height=\"215\" \/><figcaption id=\"caption-attachment-350\" class=\"wp-caption-text\">You&#8217;ll find IP address in console for client. It is an address where server is listening<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tserver = new ServerSocket(8888);\r\n\tSystem.out.println(server.getInetAddress().getLocalHost());\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>Chat Window Screen in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<figure id=\"attachment_351\" aria-describedby=\"caption-attachment-351\" style=\"width: 403px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-351 size-full\" src=\"http:\/\/localhost\/blog\/wp-content\/uploads\/2016\/11\/server_chat.jpg\" alt=\"Server Chat Room\" width=\"403\" height=\"493\" \/><figcaption id=\"caption-attachment-351\" class=\"wp-caption-text\">It is a Server Chat Window for chatting<\/figcaption><\/figure>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic JavaServer() {\r\n\t\tsuper(&quot;Java Server&quot;);\r\n\t\tsetBounds(0, 0, 407, 495);\r\n\t\tsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tsetResizable(false);\r\n\t\tsetLayout(null);\r\n\r\n\t\tmsgRec.setEditable(false);\r\n\t\tmsgRec.setBackground(Color.BLACK);\r\n\t\tmsgRec.setForeground(Color.WHITE);\r\n\t\tmsgRec.addFocusListener(this);\r\n\t\tmsgRec.setText(&quot;&quot;);\r\n\r\n\t\tmsgRec.setWrapStyleWord(true);\r\n\t\tmsgRec.setLineWrap(true);\r\n\r\n\t\tpane2 = new JScrollPane(msgRec);\r\n\t\tpane2.setBounds(0, 0, 400, 200);\r\n\t\tpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane2);\r\n\r\n\t\tmsgSend.setBackground(Color.LIGHT_GRAY);\r\n\t\tmsgSend.setForeground(Color.BLACK);\r\n\t\tmsgSend.setLineWrap(true);\r\n\t\tmsgSend.setWrapStyleWord(true);\r\n\r\n\t\tmsgSend.setText(&quot;Write Message here&quot;);\r\n\t\tmsgSend.addFocusListener(this);\r\n\t\tmsgSend.addKeyListener(this);\r\n\r\n\t\tpane1 = new JScrollPane(msgSend);\r\n\t\tpane1.setBounds(0, 200, 400, 200);\r\n\t\tpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane1);\r\n\r\n\t\tsend.setBounds(0, 400, 400, 40);\r\n\t\tadd(send);\r\n\t\tsend.addActionListener(this);\r\n\r\n\t\tbar.add(messanger);\r\n\t\tmessanger.add(logOut);\r\n\t\tlogOut.addActionListener(this);\r\n\r\n\t\tbar.add(help);\r\n\t\thelp.add(s_keys);\r\n\t\ts_keys.addActionListener(this);\r\n\t\thelp.add(about);\r\n\t\tabout.addActionListener(this);\r\n\r\n\t\tsetJMenuBar(bar);\r\n\r\n\t\taddWindowFocusListener(new WindowFocusListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void windowGainedFocus(WindowEvent e) {\r\n\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\tSystem.out.println(&quot;Yes Focus&quot;);\r\n\r\n\t\t\t\t\twriter.println(&quot;\\t&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&quot; + userName + &quot;: Focusing to Comunication&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void windowLostFocus(WindowEvent e) {\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\twriter.println(&quot;\\t&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&quot; + userName + &quot;: Ignoring to Comunication&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t\tif ((userName) != null) {\r\n\t\t\tsetVisible(true);\r\n\t\t} else {\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>Complete Sever App Code in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport java.awt.Color;\r\nimport java.awt.event.ActionEvent;\r\nimport java.awt.event.ActionListener;\r\nimport java.awt.event.FocusEvent;\r\nimport java.awt.event.FocusListener;\r\nimport java.awt.event.KeyEvent;\r\nimport java.awt.event.KeyListener;\r\nimport java.awt.event.WindowEvent;\r\nimport java.awt.event.WindowFocusListener;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.net.ServerSocket;\r\nimport java.net.Socket;\r\n\r\nimport javax.swing.JButton;\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JMenu;\r\nimport javax.swing.JMenuBar;\r\nimport javax.swing.JMenuItem;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JScrollPane;\r\nimport javax.swing.JTextArea;\r\nimport javax.swing.text.DefaultCaret;\r\n\r\npublic class JavaServer extends JFrame implements ActionListener, KeyListener,\r\n\t\tFocusListener {\r\n\r\n\t\/\/ Extra variables\r\n\tstatic String message = &quot;&quot;;\r\n\tstatic String userName = &quot;&quot;;\r\n\r\n\t\/\/ Networking Variables\r\n\tstatic ServerSocket server = null;\r\n\tstatic Socket socket = null;\r\n\tstatic PrintWriter writer = null;\r\n\r\n\t\/\/ \/\/ Graphics Variables\r\n\tstatic JTextArea msgRec = new JTextArea(100, 50);\r\n\tstatic JTextArea msgSend = new JTextArea(100, 50);\r\n\tJButton send = new JButton(&quot;Send&quot;);\r\n\tJScrollPane pane2, pane1;\r\n\r\n\tJMenuBar bar = new JMenuBar();\r\n\r\n\tJMenu messanger = new JMenu(&quot;Messanger&quot;);\r\n\tJMenuItem logOut = new JMenuItem(&quot;Log Out&quot;);\r\n\r\n\tJMenu help = new JMenu(&quot;Help&quot;);\r\n\tJMenuItem s_keys = new JMenuItem(&quot;Shortcut Keys&quot;);\r\n\tJMenuItem about = new JMenuItem(&quot;about&quot;);\r\n\r\n\tpublic JavaServer() {\r\n\t\tsuper(&quot;Java Server&quot;);\r\n\t\tsetBounds(0, 0, 407, 495);\r\n\t\tsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tsetResizable(false);\r\n\t\tsetLayout(null);\r\n\r\n\t\tmsgRec.setEditable(false);\r\n\t\tmsgRec.setBackground(Color.BLACK);\r\n\t\tmsgRec.setForeground(Color.WHITE);\r\n\t\tmsgRec.addFocusListener(this);\r\n\t\tmsgRec.setText(&quot;&quot;);\r\n\r\n\t\tmsgRec.setWrapStyleWord(true);\r\n\t\tmsgRec.setLineWrap(true);\r\n\r\n\t\tpane2 = new JScrollPane(msgRec);\r\n\t\tpane2.setBounds(0, 0, 400, 200);\r\n\t\tpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane2);\r\n\r\n\t\tmsgSend.setBackground(Color.LIGHT_GRAY);\r\n\t\tmsgSend.setForeground(Color.BLACK);\r\n\t\tmsgSend.setLineWrap(true);\r\n\t\tmsgSend.setWrapStyleWord(true);\r\n\r\n\t\tmsgSend.setText(&quot;Write Message here&quot;);\r\n\t\tmsgSend.addFocusListener(this);\r\n\t\tmsgSend.addKeyListener(this);\r\n\r\n\t\tpane1 = new JScrollPane(msgSend);\r\n\t\tpane1.setBounds(0, 200, 400, 200);\r\n\t\tpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane1);\r\n\r\n\t\tsend.setBounds(0, 400, 400, 40);\r\n\t\tadd(send);\r\n\t\tsend.addActionListener(this);\r\n\r\n\t\tbar.add(messanger);\r\n\t\tmessanger.add(logOut);\r\n\t\tlogOut.addActionListener(this);\r\n\r\n\t\tbar.add(help);\r\n\t\thelp.add(s_keys);\r\n\t\ts_keys.addActionListener(this);\r\n\t\thelp.add(about);\r\n\t\tabout.addActionListener(this);\r\n\r\n\t\tsetJMenuBar(bar);\r\n\r\n\t\taddWindowFocusListener(new WindowFocusListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void windowGainedFocus(WindowEvent e) {\r\n\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\tSystem.out.println(&quot;Yes Focus&quot;);\r\n\r\n\t\t\t\t\twriter.println(&quot;\\t&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&quot; + userName + &quot;: Focusing to Comunication&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void windowLostFocus(WindowEvent e) {\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\twriter.println(&quot;\\t&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&amp;amp;amp;amp;lt;&quot; + userName + &quot;: Ignoring to Comunication&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&amp;amp;amp;amp;gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t\tif ((userName) != null) {\r\n\t\t\tsetVisible(true);\r\n\t\t} else {\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}\r\n\r\n\t\/**\r\n\t * @param args\r\n\t *\/\r\n\r\n\tpublic static void main(String&#x5B;] args) throws Exception {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\t\tuserName = JOptionPane.showInputDialog(&quot;User Name (Server)&quot;);\r\n\r\n\t\t\/\/ swing thread\r\n\t\t(new Thread(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\t\t\t\tnew JavaServer();\r\n\t\t\t}\r\n\r\n\t\t})).start();\r\n\r\n\t\tserver = new ServerSocket(8888);\r\n\t\tSystem.out.println(server.getInetAddress().getLocalHost());\r\n\t\t\r\n\t\tsocket = server.accept();\r\n\r\n\t\tmsgRec.setText(&quot;Connected!&quot;);\r\n\t\t\/\/ listening port thread\r\n\t\t(new Thread(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\r\n\t\t\t\ttry {\r\n\t\t\t\t\tBufferedReader reader = new BufferedReader(\r\n\t\t\t\t\t\t\tnew InputStreamReader(socket.getInputStream()));\r\n\r\n\t\t\t\t\tString line = null;\r\n\t\t\t\t\tboolean testFlag = true;\r\n\t\t\t\t\twhile ((line = reader.readLine()) != null) {\r\n\r\n\t\t\t\t\t\tmsgRec.append(&quot;\\n&quot; + line);\r\n\r\n\t\t\t\t\t\t\/\/ Cursor Update\r\n\t\t\t\t\t\tcursorUpdate();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} catch (IOException ee) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tserver.close();\r\n\t\t\t\t\t\tsocket.close();\r\n\t\t\t\t\t} catch (IOException eee) {\r\n\t\t\t\t\t\teee.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tee.printStackTrace();\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t})).start();\r\n\r\n\t\ttry {\r\n\t\t\twriter = new PrintWriter(socket.getOutputStream(), true);\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\ttry {\r\n\t\t\t\tserver.close();\r\n\t\t\t\tsocket.close();\r\n\t\t\t} catch (IOException eee) {\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/ ActionEvents\r\n\t@Override\r\n\tpublic void actionPerformed(ActionEvent e) {\r\n\t\tObject scr = e.getSource();\r\n\r\n\t\tif (scr == send) {\r\n\t\t\tsendMessage();\r\n\t\t} else if (scr == logOut) {\r\n\r\n\t\t\tSystem.exit(0);\r\n\r\n\t\t} else if (scr == s_keys) {\r\n\r\n\t\t\tJOptionPane.showMessageDialog(this,\r\n\t\t\t\t\t&quot;(shift+Enter) for new line while writing message&quot;\r\n\t\t\t\t\t\t\t+ &quot;\\n(ctrl+x) for quit&quot;);\r\n\r\n\t\t} else if (scr == about) {\r\n\t\t\tJOptionPane.showMessageDialog(this,\r\n\t\t\t\t\t&quot;Messanger 1.0\\ndeveloped @IMCS University of Sindh&quot;);\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/ \/ KeyBoardEvents\r\n\r\n\t@Override\r\n\tpublic void keyTyped(KeyEvent e) {\r\n\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void keyReleased(KeyEvent e) {\r\n\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void keyPressed(KeyEvent e) {\r\n\r\n\t\tif ((e.getKeyCode() == KeyEvent.VK_ENTER) &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; e.isShiftDown()) {\r\n\t\t\tmsgSend.append(&quot;\\n&quot;);\r\n\r\n\t\t} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {\r\n\t\t\tsendMessage();\r\n\t\t}\r\n\r\n\t\telse if ((e.getKeyCode() == KeyEvent.VK_X) &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; e.isControlDown()) {\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/ FocusEvents\r\n\t@Override\r\n\tpublic void focusGained(FocusEvent e) {\r\n\r\n\t\tif (e.getSource() == msgRec) {\r\n\t\t\tif (!(msgRec.getText().equals(&quot;&quot;) || msgRec.getText().equals(\r\n\t\t\t\t\t&quot;Connected!&quot;))) {\r\n\r\n\t\t\t\twriter.println(&quot;\\t ***&quot; + userName\r\n\t\t\t\t\t\t+ &quot;: The Msg is being read......***&quot;);\r\n\t\t\t\twriter.flush();\r\n\t\t\t}\r\n\t\t} else if (e.getSource() == msgSend) {\r\n\t\t\t\/\/ Set Mesg sending area clear\r\n\t\t\tif (msgSend.getText().equals(&quot;Write Message here&quot;)) {\r\n\t\t\t\tmsgSend.setText(&quot;&quot;);\r\n\t\t\t} else {\r\n\t\t\t\twriter.println(&quot;\\t ***&quot; + userName\r\n\t\t\t\t\t\t+ &quot;: The Msg is being typed......***&quot;);\r\n\t\t\t\twriter.flush();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void focusLost(FocusEvent e) {\r\n\r\n\t}\r\n\r\n\tprivate void sendMessage() {\r\n\t\twriter.println(userName + &quot; :&quot; + msgSend.getText());\r\n\t\twriter.flush();\r\n\r\n\t\tmsgRec.append(&quot;\\nMe: &quot; + msgSend.getText());\r\n\r\n\t\tcursorUpdate();\r\n\r\n\t\tmsgSend.setText(&quot;&quot;);\r\n\t\tmsgSend.setCaretPosition(0);\r\n\t}\r\n\r\n\tprivate static void cursorUpdate() {\r\n\t\t\/\/ Update cursor position\r\n\t\tDefaultCaret caret = (DefaultCaret) msgRec.getCaret();\r\n\t\tcaret.setDot(msgRec.getDocument().getLength());\r\n\r\n\t\tDefaultCaret caret2 = (DefaultCaret) msgSend.getCaret();\r\n\t\tcaret2.setDot(msgSend.getDocument().getLength());\r\n\t}\r\n\r\n}\r\n<\/pre>\n<h2>\u00a0Client App Development in &#8220;Chat Messenger Java Project Code project&#8221;<\/h2>\n<h4>UserName Input Screen in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<figure id=\"attachment_349\" aria-describedby=\"caption-attachment-349\" style=\"width: 293px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-349\" src=\"http:\/\/localhost\/blog\/wp-content\/uploads\/2016\/11\/client_input.jpg\" alt=\"User Input Client\" width=\"293\" height=\"123\" \/><figcaption id=\"caption-attachment-349\" class=\"wp-caption-text\">It takes User Name input for Server App<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nuserName = JOptionPane.showInputDialog(&quot;User Name (Client)&quot;);\r\n<\/pre>\n<h4>IP address Input Screen in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<figure id=\"attachment_348\" aria-describedby=\"caption-attachment-348\" style=\"width: 293px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-348\" src=\"http:\/\/localhost\/blog\/wp-content\/uploads\/2016\/11\/client_address.jpg\" alt=\"IP address input\" width=\"293\" height=\"123\" \/><figcaption id=\"caption-attachment-348\" class=\"wp-caption-text\">It takes IP address of Server machine. which listens for client communication<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\tiPAddress = JOptionPane.showInputDialog(&quot;Enter Server IpAddress&quot;);\r\n<\/pre>\n<h4>Client Chat Window Input in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<figure id=\"attachment_347\" aria-describedby=\"caption-attachment-347\" style=\"width: 403px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-347 size-full\" src=\"http:\/\/localhost\/blog\/wp-content\/uploads\/2016\/11\/after_connected_sever.jpg\" alt=\"Client Window Chat Room \" width=\"403\" height=\"493\" \/><figcaption id=\"caption-attachment-347\" class=\"wp-caption-text\">It is a client window chat for communication<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic JavaClient() {\r\n\t\tsuper(&quot;Java Client&quot;);\r\n\t\tsetBounds(0, 0, 407, 495);\r\n\t\tsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tsetResizable(false);\r\n\t\tsetLayout(null);\r\n\r\n\t\tmsgRec.setEditable(false);\r\n\t\tmsgRec.setBackground(Color.BLACK);\r\n\t\tmsgRec.setForeground(Color.WHITE);\r\n\t\tmsgRec.addFocusListener(this);\r\n\t\tmsgRec.setText(&quot;&quot;);\r\n\r\n\t\tmsgRec.setWrapStyleWord(true);\r\n\t\tmsgRec.setLineWrap(true);\r\n\r\n\t\tpane2 = new JScrollPane(msgRec);\r\n\t\tpane2.setBounds(0, 0, 400, 200);\r\n\t\tpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane2);\r\n\r\n\t\tmsgSend.setBackground(Color.LIGHT_GRAY);\r\n\t\tmsgSend.setForeground(Color.BLACK);\r\n\t\tmsgSend.setLineWrap(true);\r\n\t\tmsgSend.setWrapStyleWord(true);\r\n\r\n\t\tmsgSend.setText(&quot;Write Message here&quot;);\r\n\t\tmsgSend.addFocusListener(this);\r\n\t\tmsgSend.addKeyListener(this);\r\n\r\n\t\tpane1 = new JScrollPane(msgSend);\r\n\t\tpane1.setBounds(0, 200, 400, 200);\r\n\t\tpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane1);\r\n\r\n\t\tsend.setBounds(0, 400, 400, 40);\r\n\t\tadd(send);\r\n\t\tsend.addActionListener(this);\r\n\r\n\t\tbar.add(messanger);\r\n\t\tmessanger.add(logOut);\r\n\t\tlogOut.addActionListener(this);\r\n\r\n\t\tbar.add(help);\r\n\t\thelp.add(s_keys);\r\n\t\ts_keys.addActionListener(this);\r\n\t\thelp.add(about);\r\n\t\tabout.addActionListener(this);\r\n\r\n\t\tsetJMenuBar(bar);\r\n\r\n\t\taddWindowFocusListener(new WindowFocusListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void windowGainedFocus(WindowEvent e) {\r\n\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\tSystem.out.println(&quot;Yes Focus&quot;);\r\n\r\n\t\t\t\t\twriter.println(&quot;\\t&lt;&lt;&lt;&quot; + userName + &quot;: Focusing to Comunication&gt;&gt;&gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void windowLostFocus(WindowEvent e) {\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\twriter.println(&quot;\\t&lt;&lt;&lt;&quot; + userName + &quot;: Ignoring to Comunication&gt;&gt;&gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t\tif ((userName) != null) {\r\n\t\t\tsetVisible(true);\r\n\t\t} else {\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4>Full Code for Client App in &#8220;Chat Messenger Java Project Code project&#8221;<\/h4>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport java.awt.Color;\r\nimport java.awt.event.ActionEvent;\r\nimport java.awt.event.ActionListener;\r\nimport java.awt.event.FocusEvent;\r\nimport java.awt.event.FocusListener;\r\nimport java.awt.event.KeyEvent;\r\nimport java.awt.event.KeyListener;\r\nimport java.awt.event.WindowEvent;\r\nimport java.awt.event.WindowFocusListener;\r\nimport java.io.BufferedReader;\r\nimport java.io.IOException;\r\nimport java.io.InputStreamReader;\r\nimport java.io.PrintWriter;\r\nimport java.net.Socket;\r\n\r\nimport javax.swing.JButton;\r\nimport javax.swing.JFrame;\r\nimport javax.swing.JMenu;\r\nimport javax.swing.JMenuBar;\r\nimport javax.swing.JMenuItem;\r\nimport javax.swing.JOptionPane;\r\nimport javax.swing.JScrollPane;\r\nimport javax.swing.JTextArea;\r\nimport javax.swing.text.DefaultCaret;\r\n\r\npublic class JavaClient extends JFrame implements ActionListener, KeyListener,\r\n\t\tFocusListener {\r\n\r\n\t\/\/ Extra variables\r\n\tstatic String message = &quot;&quot;;\r\n\tstatic String userName = &quot;&quot;;\r\n\tstatic String iPAddress = null;\r\n\r\n\t\/\/ Networking Variables\r\n\tstatic Socket socket = null;\r\n\tstatic PrintWriter writer = null;\r\n\r\n\t\/\/ \/\/ Graphics Variables\r\n\tstatic JTextArea msgRec = new JTextArea(100, 50);\r\n\tstatic JTextArea msgSend = new JTextArea(100, 50);\r\n\tJButton send = new JButton(&quot;Send&quot;);\r\n\tJScrollPane pane2, pane1;\r\n\r\n\tJMenuBar bar = new JMenuBar();\r\n\r\n\tJMenu messanger = new JMenu(&quot;Messanger&quot;);\r\n\tJMenuItem logOut = new JMenuItem(&quot;Log Out&quot;);\r\n\r\n\tJMenu help = new JMenu(&quot;Help&quot;);\r\n\tJMenuItem s_keys = new JMenuItem(&quot;Shortcut Keys&quot;);\r\n\tJMenuItem about = new JMenuItem(&quot;about&quot;);\r\n\r\n\tpublic JavaClient() {\r\n\t\tsuper(&quot;Java Client&quot;);\r\n\t\tsetBounds(0, 0, 407, 495);\r\n\t\tsetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tsetResizable(false);\r\n\t\tsetLayout(null);\r\n\r\n\t\tmsgRec.setEditable(false);\r\n\t\tmsgRec.setBackground(Color.BLACK);\r\n\t\tmsgRec.setForeground(Color.WHITE);\r\n\t\tmsgRec.addFocusListener(this);\r\n\t\tmsgRec.setText(&quot;&quot;);\r\n\r\n\t\tmsgRec.setWrapStyleWord(true);\r\n\t\tmsgRec.setLineWrap(true);\r\n\r\n\t\tpane2 = new JScrollPane(msgRec);\r\n\t\tpane2.setBounds(0, 0, 400, 200);\r\n\t\tpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane2);\r\n\r\n\t\tmsgSend.setBackground(Color.LIGHT_GRAY);\r\n\t\tmsgSend.setForeground(Color.BLACK);\r\n\t\tmsgSend.setLineWrap(true);\r\n\t\tmsgSend.setWrapStyleWord(true);\r\n\r\n\t\tmsgSend.setText(&quot;Write Message here&quot;);\r\n\t\tmsgSend.addFocusListener(this);\r\n\t\tmsgSend.addKeyListener(this);\r\n\r\n\t\tpane1 = new JScrollPane(msgSend);\r\n\t\tpane1.setBounds(0, 200, 400, 200);\r\n\t\tpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tadd(pane1);\r\n\r\n\t\tsend.setBounds(0, 400, 400, 40);\r\n\t\tadd(send);\r\n\t\tsend.addActionListener(this);\r\n\r\n\t\tbar.add(messanger);\r\n\t\tmessanger.add(logOut);\r\n\t\tlogOut.addActionListener(this);\r\n\r\n\t\tbar.add(help);\r\n\t\thelp.add(s_keys);\r\n\t\ts_keys.addActionListener(this);\r\n\t\thelp.add(about);\r\n\t\tabout.addActionListener(this);\r\n\r\n\t\tsetJMenuBar(bar);\r\n\r\n\t\taddWindowFocusListener(new WindowFocusListener() {\r\n\t\t\t@Override\r\n\t\t\tpublic void windowGainedFocus(WindowEvent e) {\r\n\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\tSystem.out.println(&quot;Yes Focus&quot;);\r\n\r\n\t\t\t\t\twriter.println(&quot;\\t&lt;&lt;&lt;&quot; + userName + &quot;: Focusing to Comunication&gt;&gt;&gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void windowLostFocus(WindowEvent e) {\r\n\t\t\t\tif (!msgRec.getText().equals(&quot;&quot;)) {\r\n\t\t\t\t\twriter.println(&quot;\\t&lt;&lt;&lt;&quot; + userName + &quot;: Ignoring to Comunication&gt;&gt;&gt;&quot;);\r\n\t\t\t\t\twriter.flush();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t});\r\n\r\n\t\tif ((userName) != null) {\r\n\t\t\tsetVisible(true);\r\n\t\t} else {\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}\r\n\r\n\t\/**\r\n\t * @param args\r\n\t *\/\r\n\tpublic static void main(String&#x5B;] args) throws Exception {\r\n\t\t\/\/ TODO Auto-generated method stub\r\n\r\n\t\tuserName = JOptionPane.showInputDialog(&quot;User Name (Client)&quot;);\r\n\t\tiPAddress = JOptionPane.showInputDialog(&quot;Enter Server IpAddress&quot;);\r\n\r\n\t\t\/\/ swing thread\r\n\t\t(new Thread(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\t\t\t\tnew JavaClient();\r\n\r\n\t\t\t}\r\n\r\n\t\t})).start();\r\n\r\n\t\tsocket = new Socket(iPAddress, 8888);\r\n\t\tmsgRec.setText(&quot;Connected!&quot;);\r\n\r\n\t\t\/\/ listening port thread\r\n\t\t(new Thread(new Runnable() {\r\n\t\t\tpublic void run() {\r\n\r\n\t\t\t\ttry {\r\n\t\t\t\t\tBufferedReader reader = new BufferedReader(\r\n\t\t\t\t\t\t\tnew InputStreamReader(socket.getInputStream()));\r\n\r\n\t\t\t\t\tString line = null;\r\n\t\t\t\t\tboolean testFlag = true;\r\n\t\t\t\t\twhile ((line = reader.readLine()) != null) {\r\n\t\t\t\t\t\tmsgRec.append(&quot;\\n&quot; + line);\r\n\t\t\t\t\t\tcursorUpdate();\r\n\r\n\t\t\t\t\t\tif (!reader.ready()) {\r\n\t\t\t\t\t\t\ttestFlag = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} catch (IOException ee) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tsocket.close();\r\n\t\t\t\t\t} catch (IOException eee) {\r\n\t\t\t\t\t\teee.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tee.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})).start();\r\n\r\n\t\ttry {\r\n\t\t\twriter = new PrintWriter(socket.getOutputStream(), true);\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\ttry {\r\n\t\t\t\tsocket.close();\r\n\t\t\t} catch (IOException eee) {\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/ ActionEvents\r\n\r\n\t@Override\r\n\tpublic void actionPerformed(ActionEvent e) {\r\n\t\tObject scr = e.getSource();\r\n\r\n\t\tif (scr == send) {\r\n\t\t\tsendMessage();\r\n\t\t} else if (scr == logOut) {\r\n\r\n\t\t\tSystem.exit(0);\r\n\r\n\t\t} else if (scr == s_keys) {\r\n\r\n\t\t\tJOptionPane.showMessageDialog(this,\r\n\t\t\t\t\t&quot;(shift+Enter) for new line while writing message&quot;\r\n\t\t\t\t\t\t\t+ &quot;\\n(ctrl+x) for quit&quot;);\r\n\r\n\t\t} else if (scr == about) {\r\n\t\t\tJOptionPane.showMessageDialog(this,\r\n\t\t\t\t\t&quot;Messanger 1.0\\ndeveloped @IMCS University of Sindh&quot;);\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/ \/ KeyBoardEvents\r\n\r\n\t@Override\r\n\tpublic void keyTyped(KeyEvent e) {\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void keyReleased(KeyEvent e) {\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void keyPressed(KeyEvent e) {\r\n\r\n\t\tif ((e.getKeyCode() == KeyEvent.VK_ENTER) &amp;&amp; e.isShiftDown()) {\r\n\t\t\tmsgSend.append(&quot;\\n&quot;);\r\n\r\n\t\t} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {\r\n\t\t\tsendMessage();\r\n\t\t}\r\n\r\n\t\telse if ((e.getKeyCode() == KeyEvent.VK_X) &amp;&amp; e.isControlDown()) {\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t}\r\n\r\n\t\/\/ FocusEvents\r\n\t@Override\r\n\tpublic void focusGained(FocusEvent e) {\r\n\r\n\t\tif (e.getSource() == msgRec) {\r\n\t\t\tif (!(msgRec.getText().equals(&quot;&quot;) || msgRec.getText().equals(\r\n\t\t\t\t\t&quot;Connected!&quot;))) {\r\n\r\n\t\t\t\twriter.println(&quot;\\t ***&quot; + userName\r\n\t\t\t\t\t\t+ &quot;: The Msg is being read......***&quot;);\r\n\t\t\t\twriter.flush();\r\n\t\t\t}\r\n\t\t} else if (e.getSource() == msgSend) {\r\n\t\t\t\/\/ Set Mesg sending area clear\r\n\t\t\tif (msgSend.getText().equals(&quot;Write Message here&quot;)) {\r\n\t\t\t\tmsgSend.setText(&quot;&quot;);\r\n\t\t\t} else {\r\n\t\t\t\twriter.println(&quot;\\t ***&quot; + userName\r\n\t\t\t\t\t\t+ &quot;: The Msg is being typed......***&quot;);\r\n\t\t\t\twriter.flush();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void focusLost(FocusEvent e) {\r\n\t}\r\n\r\n\tprivate void sendMessage() {\r\n\t\twriter.println(userName + &quot; :&quot; + msgSend.getText());\r\n\r\n\t\tmsgRec.append(&quot;\\nMe: &quot; + msgSend.getText());\r\n\t\twriter.flush();\r\n\t\tcursorUpdate();\r\n\r\n\t\tmsgSend.setText(&quot;&quot;);\r\n\t\tmsgSend.setCaretPosition(0);\r\n\t}\r\n\r\n\tprivate static void cursorUpdate() {\r\n\t\t\/\/ Update cursor position\r\n\t\tDefaultCaret caret = (DefaultCaret) msgRec.getCaret();\r\n\t\tcaret.setDot(msgRec.getDocument().getLength());\r\n\r\n\t\tDefaultCaret caret2 = (DefaultCaret) msgSend.getCaret();\r\n\t\tcaret2.setDot(msgSend.getDocument().getLength());\r\n\t}\r\n}\r\n\r\n\/\/ A Java Client program will take a Server Ip address\r\n<\/pre>\n<h4>If you want to know other projects and Tutorials Please visit <a href=\"http:\/\/sindhitutorials.com\/\">Home<\/a><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>Chat Messenger Java Project Code The Project &#8220;Chat Messenger Java Project Code&#8221; is an example of Java Chat App. If&#8230; <\/p>\n","protected":false},"author":1,"featured_media":373,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,154,153,126],"tags":[],"class_list":["post-368","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core","category-java","category-java-projects","category-projects"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Chat Messenger Java Project Code Swing AWT Socket - SindhiTutorials<\/title>\n<meta name=\"description\" content=\"A best project Chat Messenger Java Project Code. You can make best chat application in Java using Swing, AWT and Socket Programming within 3 - 4 hours dev..\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Chat Messenger Java Project Code Swing AWT Socket - SindhiTutorials\" \/>\n<meta property=\"og:description\" content=\"A best project Chat Messenger Java Project Code. You can make best chat application in Java using Swing, AWT and Socket Programming within 3 - 4 hours dev..\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/\" \/>\n<meta property=\"og:site_name\" content=\"SindhiTutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sindhitutorials\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/sindhitutorials\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-27T18:47:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-13T17:03:12+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"728\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"sadiqodho\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SindhiTutorials\" \/>\n<meta name=\"twitter:site\" content=\"@SindhiTutorials\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"sadiqodho\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/\",\"url\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/\",\"name\":\"Chat Messenger Java Project Code Swing AWT Socket - SindhiTutorials\",\"isPartOf\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg\",\"datePublished\":\"2016-11-27T18:47:29+00:00\",\"dateModified\":\"2018-10-13T17:03:12+00:00\",\"author\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169\"},\"description\":\"A best project Chat Messenger Java Project Code. You can make best chat application in Java using Swing, AWT and Socket Programming within 3 - 4 hours dev..\",\"breadcrumb\":{\"@id\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#primaryimage\",\"url\":\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg\",\"contentUrl\":\"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg\",\"width\":1366,\"height\":728,\"caption\":\"Chat Messenger Java Project Code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sindhitutorials.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Chat Messenger Java Project Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#website\",\"url\":\"https:\/\/sindhitutorials.com\/blog\/\",\"name\":\"SindhiTutorials\",\"description\":\"A Platform for learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sindhitutorials.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169\",\"name\":\"sadiqodho\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g\",\"caption\":\"sadiqodho\"},\"description\":\"I am passionate about teaching and learning\",\"sameAs\":[\"http:\/\/sindhitutorials.com\/\",\"https:\/\/www.facebook.com\/sindhitutorials\/\"],\"url\":\"https:\/\/sindhitutorials.com\/blog\/author\/sadiqodho\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Chat Messenger Java Project Code Swing AWT Socket - SindhiTutorials","description":"A best project Chat Messenger Java Project Code. You can make best chat application in Java using Swing, AWT and Socket Programming within 3 - 4 hours dev..","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:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/","og_locale":"en_US","og_type":"article","og_title":"Chat Messenger Java Project Code Swing AWT Socket - SindhiTutorials","og_description":"A best project Chat Messenger Java Project Code. You can make best chat application in Java using Swing, AWT and Socket Programming within 3 - 4 hours dev..","og_url":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/","og_site_name":"SindhiTutorials","article_publisher":"https:\/\/www.facebook.com\/sindhitutorials\/","article_author":"https:\/\/www.facebook.com\/sindhitutorials\/","article_published_time":"2016-11-27T18:47:29+00:00","article_modified_time":"2018-10-13T17:03:12+00:00","og_image":[{"width":1366,"height":728,"url":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg","type":"image\/jpeg"}],"author":"sadiqodho","twitter_card":"summary_large_image","twitter_creator":"@SindhiTutorials","twitter_site":"@SindhiTutorials","twitter_misc":{"Written by":"sadiqodho","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/","url":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/","name":"Chat Messenger Java Project Code Swing AWT Socket - SindhiTutorials","isPartOf":{"@id":"https:\/\/sindhitutorials.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#primaryimage"},"image":{"@id":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#primaryimage"},"thumbnailUrl":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg","datePublished":"2016-11-27T18:47:29+00:00","dateModified":"2018-10-13T17:03:12+00:00","author":{"@id":"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169"},"description":"A best project Chat Messenger Java Project Code. You can make best chat application in Java using Swing, AWT and Socket Programming within 3 - 4 hours dev..","breadcrumb":{"@id":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#primaryimage","url":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg","contentUrl":"https:\/\/sindhitutorials.com\/blog\/wp-content\/uploads\/2016\/11\/final-result.jpg","width":1366,"height":728,"caption":"Chat Messenger Java Project Code"},{"@type":"BreadcrumbList","@id":"https:\/\/sindhitutorials.com\/blog\/chat-messenger-java-project-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sindhitutorials.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Chat Messenger Java Project Code"}]},{"@type":"WebSite","@id":"https:\/\/sindhitutorials.com\/blog\/#website","url":"https:\/\/sindhitutorials.com\/blog\/","name":"SindhiTutorials","description":"A Platform for learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sindhitutorials.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/0643c170d77d3d0db865c1e7f6f56169","name":"sadiqodho","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sindhitutorials.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c25afbd4104cdbe5c36d38acbb81619f?s=96&r=g","caption":"sadiqodho"},"description":"I am passionate about teaching and learning","sameAs":["http:\/\/sindhitutorials.com\/","https:\/\/www.facebook.com\/sindhitutorials\/"],"url":"https:\/\/sindhitutorials.com\/blog\/author\/sadiqodho\/"}]}},"_links":{"self":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":3,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"predecessor-version":[{"id":378,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/posts\/368\/revisions\/378"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/media\/373"}],"wp:attachment":[{"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sindhitutorials.com\/blog\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}