You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ChatView.java 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package chatProg.view;
  7. /**
  8. *
  9. * @author hd
  10. */
  11. public class ChatView extends javax.swing.JFrame
  12. {
  13. /**
  14. * @return the jTextArea
  15. */
  16. public javax.swing.JTextArea getjTextArea()
  17. {
  18. return jTextArea;
  19. }
  20. /**
  21. * @return the btnSend
  22. */
  23. public javax.swing.JButton getBtnSend()
  24. {
  25. return btnSend;
  26. }
  27. /**
  28. * @return the btnSetClient
  29. */
  30. public javax.swing.JButton getBtnSetClient()
  31. {
  32. return btnSetClient;
  33. }
  34. /**
  35. * @return the btnSetServer
  36. */
  37. public javax.swing.JButton getBtnSetServer()
  38. {
  39. return btnSetServer;
  40. }
  41. /**
  42. * @return the lblStatusDialog
  43. */
  44. public javax.swing.JLabel getLblStatusDialog()
  45. {
  46. return lblStatusDialog;
  47. }
  48. /**
  49. * @param lblStatusDialog the lblStatusDialog to set
  50. */
  51. public void setLblStatusDialog(javax.swing.JLabel lblStatusDialog)
  52. {
  53. this.lblStatusDialog = lblStatusDialog;
  54. }
  55. /**
  56. * @return the lblType
  57. */
  58. public javax.swing.JLabel getLblType()
  59. {
  60. return lblType;
  61. }
  62. /**
  63. * @param lblType the lblType to set
  64. */
  65. public void setLblType(javax.swing.JLabel lblType)
  66. {
  67. this.lblType = lblType;
  68. }
  69. /**
  70. * @return the txtField
  71. */
  72. public javax.swing.JTextField getTxtField()
  73. {
  74. return txtField;
  75. }
  76. /**
  77. * @param txtField the txtField to set
  78. */
  79. public void setTxtField(javax.swing.JTextField txtField)
  80. {
  81. this.txtField = txtField;
  82. }
  83. /**
  84. * Creates new form chatView
  85. */
  86. public ChatView()
  87. {
  88. initComponents();
  89. }
  90. /**
  91. * This method is called from within the constructor to initialize the form.
  92. * WARNING: Do NOT modify this code. The content of this method is always
  93. * regenerated by the Form Editor.
  94. */
  95. @SuppressWarnings("unchecked")
  96. // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  97. private void initComponents()
  98. {
  99. jPanel1 = new javax.swing.JPanel();
  100. lblType = new javax.swing.JLabel();
  101. btnSetClient = new javax.swing.JButton();
  102. btnSetServer = new javax.swing.JButton();
  103. btnSend = new javax.swing.JButton();
  104. lblStatusDialog = new javax.swing.JLabel();
  105. jPanel2 = new javax.swing.JPanel();
  106. jScrollPane1 = new javax.swing.JScrollPane();
  107. jTextArea = new javax.swing.JTextArea();
  108. txtField = new javax.swing.JTextField();
  109. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  110. setTitle("ChatTool");
  111. jPanel1.setLayout(new java.awt.GridLayout(1, 0));
  112. jPanel1.add(lblType);
  113. btnSetClient.setText("Client");
  114. jPanel1.add(btnSetClient);
  115. btnSetServer.setText("Server");
  116. jPanel1.add(btnSetServer);
  117. getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
  118. btnSend.setText("Send");
  119. getContentPane().add(btnSend, java.awt.BorderLayout.LINE_END);
  120. lblStatusDialog.setText("\"\"");
  121. getContentPane().add(lblStatusDialog, java.awt.BorderLayout.PAGE_END);
  122. jPanel2.setLayout(new java.awt.GridLayout(2, 1));
  123. jTextArea.setEditable(false);
  124. jTextArea.setBackground(new java.awt.Color(204, 204, 204));
  125. jTextArea.setColumns(20);
  126. jTextArea.setRows(5);
  127. jScrollPane1.setViewportView(jTextArea);
  128. jPanel2.add(jScrollPane1);
  129. txtField.addActionListener(new java.awt.event.ActionListener()
  130. {
  131. public void actionPerformed(java.awt.event.ActionEvent evt)
  132. {
  133. txtFieldActionPerformed(evt);
  134. }
  135. });
  136. jPanel2.add(txtField);
  137. getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
  138. pack();
  139. }// </editor-fold>//GEN-END:initComponents
  140. private void txtFieldActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_txtFieldActionPerformed
  141. {//GEN-HEADEREND:event_txtFieldActionPerformed
  142. // TODO add your handling code here:
  143. }//GEN-LAST:event_txtFieldActionPerformed
  144. /**
  145. * @param args the command line arguments
  146. */
  147. public static void main(String args[])
  148. {
  149. /* Set the Nimbus look and feel */
  150. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  151. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  152. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  153. */
  154. try
  155. {
  156. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
  157. {
  158. if ("Nimbus".equals(info.getName()))
  159. {
  160. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  161. break;
  162. }
  163. }
  164. }
  165. catch (ClassNotFoundException ex)
  166. {
  167. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  168. }
  169. catch (InstantiationException ex)
  170. {
  171. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  172. }
  173. catch (IllegalAccessException ex)
  174. {
  175. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  176. }
  177. catch (javax.swing.UnsupportedLookAndFeelException ex)
  178. {
  179. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  180. }
  181. //</editor-fold>
  182. //</editor-fold>
  183. //</editor-fold>
  184. //</editor-fold>
  185. /* Create and display the form */
  186. java.awt.EventQueue.invokeLater(new Runnable()
  187. {
  188. public void run()
  189. {
  190. new ChatView().setVisible(true);
  191. }
  192. });
  193. }
  194. // Variables declaration - do not modify//GEN-BEGIN:variables
  195. private javax.swing.JButton btnSend;
  196. private javax.swing.JButton btnSetClient;
  197. private javax.swing.JButton btnSetServer;
  198. private javax.swing.JPanel jPanel1;
  199. private javax.swing.JPanel jPanel2;
  200. private javax.swing.JScrollPane jScrollPane1;
  201. private javax.swing.JTextArea jTextArea;
  202. private javax.swing.JLabel lblStatusDialog;
  203. private javax.swing.JLabel lblType;
  204. private javax.swing.JTextField txtField;
  205. // End of variables declaration//GEN-END:variables
  206. }