refactored
This commit is contained in:
1 parent
1585766b5a
commit
302d193651
9 files changed
+102
-22
No files matched your search
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package chatProg.view;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hd
|
||||
*/
|
||||
public class ChatView extends javax.swing.JFrame
|
||||
{
|
||||
|
||||
/**
|
||||
* @return the jTextArea
|
||||
*/
|
||||
public javax.swing.JTextArea getjTextArea()
|
||||
{
|
||||
return jTextArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the btnSend
|
||||
*/
|
||||
public javax.swing.JButton getBtnSend()
|
||||
{
|
||||
return btnSend;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the btnSetClient
|
||||
*/
|
||||
public javax.swing.JButton getBtnSetClient()
|
||||
{
|
||||
return btnSetClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the btnSetServer
|
||||
*/
|
||||
public javax.swing.JButton getBtnSetServer()
|
||||
{
|
||||
return btnSetServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lblStatusDialog
|
||||
*/
|
||||
public javax.swing.JLabel getLblStatusDialog()
|
||||
{
|
||||
return lblStatusDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lblStatusDialog the lblStatusDialog to set
|
||||
*/
|
||||
public void setLblStatusDialog(javax.swing.JLabel lblStatusDialog)
|
||||
{
|
||||
this.lblStatusDialog = lblStatusDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lblType
|
||||
*/
|
||||
public javax.swing.JLabel getLblType()
|
||||
{
|
||||
return lblType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lblType the lblType to set
|
||||
*/
|
||||
public void setLblType(javax.swing.JLabel lblType)
|
||||
{
|
||||
this.lblType = lblType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the txtField
|
||||
*/
|
||||
public javax.swing.JTextField getTxtField()
|
||||
{
|
||||
return txtField;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param txtField the txtField to set
|
||||
*/
|
||||
public void setTxtField(javax.swing.JTextField txtField)
|
||||
{
|
||||
this.txtField = txtField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form chatView
|
||||
*/
|
||||
public ChatView()
|
||||
{
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents()
|
||||
{
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
lblType = new javax.swing.JLabel();
|
||||
btnSetClient = new javax.swing.JButton();
|
||||
btnSetServer = new javax.swing.JButton();
|
||||
btnSend = new javax.swing.JButton();
|
||||
lblStatusDialog = new javax.swing.JLabel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jTextArea = new javax.swing.JTextArea();
|
||||
txtField = new javax.swing.JTextField();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setTitle("ChatTool");
|
||||
|
||||
jPanel1.setLayout(new java.awt.GridLayout(1, 0));
|
||||
jPanel1.add(lblType);
|
||||
|
||||
btnSetClient.setText("Client");
|
||||
jPanel1.add(btnSetClient);
|
||||
|
||||
btnSetServer.setText("Server");
|
||||
jPanel1.add(btnSetServer);
|
||||
|
||||
getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);
|
||||
|
||||
btnSend.setText("Send");
|
||||
getContentPane().add(btnSend, java.awt.BorderLayout.LINE_END);
|
||||
|
||||
lblStatusDialog.setText("\"\"");
|
||||
getContentPane().add(lblStatusDialog, java.awt.BorderLayout.PAGE_END);
|
||||
|
||||
jPanel2.setLayout(new java.awt.GridLayout(2, 1));
|
||||
|
||||
jTextArea.setEditable(false);
|
||||
jTextArea.setBackground(new java.awt.Color(204, 204, 204));
|
||||
jTextArea.setColumns(20);
|
||||
jTextArea.setRows(5);
|
||||
jScrollPane1.setViewportView(jTextArea);
|
||||
|
||||
jPanel2.add(jScrollPane1);
|
||||
|
||||
txtField.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
txtFieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel2.add(txtField);
|
||||
|
||||
getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void txtFieldActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_txtFieldActionPerformed
|
||||
{//GEN-HEADEREND:event_txtFieldActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_txtFieldActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[])
|
||||
{
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try
|
||||
{
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
|
||||
{
|
||||
if ("Nimbus".equals(info.getName()))
|
||||
{
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (InstantiationException ex)
|
||||
{
|
||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (IllegalAccessException ex)
|
||||
{
|
||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
catch (javax.swing.UnsupportedLookAndFeelException ex)
|
||||
{
|
||||
java.util.logging.Logger.getLogger(ChatView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the form */
|
||||
java.awt.EventQueue.invokeLater(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
new ChatView().setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnSend;
|
||||
private javax.swing.JButton btnSetClient;
|
||||
private javax.swing.JButton btnSetServer;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JTextArea jTextArea;
|
||||
private javax.swing.JLabel lblStatusDialog;
|
||||
private javax.swing.JLabel lblType;
|
||||
private javax.swing.JTextField txtField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
Reference in new issue
Block a user