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 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 netz.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. txtField = new javax.swing.JTextField();
  104. btnSend = new javax.swing.JButton();
  105. lblStatusDialog = new javax.swing.JLabel();
  106. jScrollPane1 = new javax.swing.JScrollPane();
  107. jTextArea = new javax.swing.JTextArea();
  108. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  109. setTitle("ChatTool");
  110. jPanel1.setLayout(new java.awt.GridLayout(1, 0));
  111. lblType.setText("Client");
  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. txtField.addActionListener(new java.awt.event.ActionListener()
  119. {
  120. public void actionPerformed(java.awt.event.ActionEvent evt)
  121. {
  122. txtFieldActionPerformed(evt);
  123. }
  124. });
  125. getContentPane().add(txtField, java.awt.BorderLayout.CENTER);
  126. btnSend.setText("Send");
  127. getContentPane().add(btnSend, java.awt.BorderLayout.LINE_END);
  128. lblStatusDialog.setText("\"\"");
  129. getContentPane().add(lblStatusDialog, java.awt.BorderLayout.PAGE_END);
  130. jTextArea.setColumns(20);
  131. jTextArea.setRows(5);
  132. jScrollPane1.setViewportView(jTextArea);
  133. getContentPane().add(jScrollPane1, java.awt.BorderLayout.LINE_START);
  134. pack();
  135. }// </editor-fold>//GEN-END:initComponents
  136. private void txtFieldActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_txtFieldActionPerformed
  137. {//GEN-HEADEREND:event_txtFieldActionPerformed
  138. // TODO add your handling code here:
  139. }//GEN-LAST:event_txtFieldActionPerformed
  140. /**
  141. * @param args the command line arguments
  142. */
  143. public static void main(String args[])
  144. {
  145. /* Set the Nimbus look and feel */
  146. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  147. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  148. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  149. */
  150. try
  151. {
  152. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
  153. {
  154. if ("Nimbus".equals(info.getName()))
  155. {
  156. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  157. break;
  158. }
  159. }
  160. }
  161. catch (ClassNotFoundException ex)
  162. {
  163. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  164. }
  165. catch (InstantiationException ex)
  166. {
  167. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  168. }
  169. catch (IllegalAccessException ex)
  170. {
  171. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  172. }
  173. catch (javax.swing.UnsupportedLookAndFeelException ex)
  174. {
  175. java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  176. }
  177. //</editor-fold>
  178. //</editor-fold>
  179. //</editor-fold>
  180. //</editor-fold>
  181. /* Create and display the form */
  182. java.awt.EventQueue.invokeLater(new Runnable()
  183. {
  184. public void run()
  185. {
  186. new ChatView().setVisible(true);
  187. }
  188. });
  189. }
  190. // Variables declaration - do not modify//GEN-BEGIN:variables
  191. private javax.swing.JButton btnSend;
  192. private javax.swing.JButton btnSetClient;
  193. private javax.swing.JButton btnSetServer;
  194. private javax.swing.JPanel jPanel1;
  195. private javax.swing.JScrollPane jScrollPane1;
  196. private javax.swing.JTextArea jTextArea;
  197. private javax.swing.JLabel lblStatusDialog;
  198. private javax.swing.JLabel lblType;
  199. private javax.swing.JTextField txtField;
  200. // End of variables declaration//GEN-END:variables
  201. }