2023-12-18 10:24:38 +01:00
|
|
|
/*
|
|
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
|
|
|
*/
|
|
|
|
package ChatProgramm.view;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @author ahren
|
|
|
|
*/
|
|
|
|
public class ChatView extends javax.swing.JFrame
|
|
|
|
{
|
|
|
|
|
2023-12-18 13:07:14 +01:00
|
|
|
/**
|
|
|
|
* @return the gvZeichenflaeche
|
|
|
|
*/
|
|
|
|
public ChatProgramm.view.GrafikView getGvZeichenflaeche()
|
|
|
|
{
|
|
|
|
return gvZeichenflaeche;
|
|
|
|
}
|
|
|
|
|
2023-12-18 10:24:38 +01:00
|
|
|
/**
|
|
|
|
* 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")
|
2023-12-18 13:07:14 +01:00
|
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
|
|
private void initComponents()
|
|
|
|
{
|
|
|
|
|
|
|
|
dialogChooseMode = new javax.swing.JDialog();
|
|
|
|
lblMode = new javax.swing.JLabel();
|
|
|
|
BtnServer = new javax.swing.JRadioButton();
|
|
|
|
BtnClient = new javax.swing.JRadioButton();
|
|
|
|
jPanel1 = new javax.swing.JPanel();
|
|
|
|
BtnConnect = new javax.swing.JButton();
|
|
|
|
BtnGrpMode = new javax.swing.ButtonGroup();
|
|
|
|
gvZeichenflaeche = new ChatProgramm.view.GrafikView();
|
|
|
|
|
|
|
|
dialogChooseMode.setMinimumSize(new java.awt.Dimension(278, 208));
|
|
|
|
dialogChooseMode.getContentPane().setLayout(new java.awt.GridLayout(0, 1));
|
|
|
|
|
|
|
|
lblMode.setText(" Choose your mode:");
|
|
|
|
dialogChooseMode.getContentPane().add(lblMode);
|
|
|
|
|
|
|
|
BtnGrpMode.add(BtnServer);
|
|
|
|
BtnServer.setText("Server");
|
|
|
|
BtnServer.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
{
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
{
|
|
|
|
BtnServerActionPerformed(evt);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogChooseMode.getContentPane().add(BtnServer);
|
|
|
|
|
|
|
|
BtnGrpMode.add(BtnClient);
|
|
|
|
BtnClient.setText("Client");
|
|
|
|
BtnClient.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
{
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
{
|
|
|
|
BtnClientActionPerformed(evt);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
dialogChooseMode.getContentPane().add(BtnClient);
|
|
|
|
|
|
|
|
BtnConnect.setText("Connect");
|
|
|
|
BtnConnect.addActionListener(new java.awt.event.ActionListener()
|
|
|
|
{
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt)
|
|
|
|
{
|
|
|
|
BtnConnectActionPerformed(evt);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
|
|
|
jPanel1.setLayout(jPanel1Layout);
|
|
|
|
jPanel1Layout.setHorizontalGroup(
|
|
|
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
|
|
|
.addContainerGap(65, Short.MAX_VALUE)
|
|
|
|
.addComponent(BtnConnect)
|
|
|
|
.addContainerGap(76, Short.MAX_VALUE))
|
|
|
|
);
|
|
|
|
jPanel1Layout.setVerticalGroup(
|
|
|
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
|
|
|
.addContainerGap()
|
|
|
|
.addComponent(BtnConnect)
|
|
|
|
.addContainerGap(57, Short.MAX_VALUE))
|
|
|
|
);
|
|
|
|
|
|
|
|
dialogChooseMode.getContentPane().add(jPanel1);
|
|
|
|
|
|
|
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
|
|
setMinimumSize(new java.awt.Dimension(568, 548));
|
|
|
|
addWindowListener(new java.awt.event.WindowAdapter()
|
|
|
|
{
|
|
|
|
public void windowOpened(java.awt.event.WindowEvent evt)
|
|
|
|
{
|
|
|
|
formWindowOpened(evt);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
getContentPane().add(gvZeichenflaeche, java.awt.BorderLayout.CENTER);
|
|
|
|
|
|
|
|
pack();
|
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
2023-12-18 10:24:38 +01:00
|
|
|
|
|
|
|
private void BtnClientActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_BtnClientActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_BtnClientActionPerformed
|
|
|
|
// TODO add your handling code here:
|
|
|
|
}//GEN-LAST:event_BtnClientActionPerformed
|
|
|
|
|
|
|
|
private void BtnServerActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_BtnServerActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_BtnServerActionPerformed
|
|
|
|
// TODO add your handling code here:
|
|
|
|
}//GEN-LAST:event_BtnServerActionPerformed
|
|
|
|
|
|
|
|
private void formWindowOpened(java.awt.event.WindowEvent evt)//GEN-FIRST:event_formWindowOpened
|
|
|
|
{//GEN-HEADEREND:event_formWindowOpened
|
|
|
|
dialogChooseMode.show();
|
|
|
|
}//GEN-LAST:event_formWindowOpened
|
|
|
|
|
|
|
|
private void BtnConnectActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_BtnConnectActionPerformed
|
|
|
|
{//GEN-HEADEREND:event_BtnConnectActionPerformed
|
|
|
|
// TODO add your handling code here:
|
|
|
|
}//GEN-LAST:event_BtnConnectActionPerformed
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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>
|
|
|
|
|
|
|
|
/* Create and display the form */
|
|
|
|
java.awt.EventQueue.invokeLater(new Runnable()
|
|
|
|
{
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
new ChatView().setVisible(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-12-18 13:07:14 +01:00
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
|
|
private javax.swing.JRadioButton BtnClient;
|
|
|
|
private javax.swing.JButton BtnConnect;
|
|
|
|
private javax.swing.ButtonGroup BtnGrpMode;
|
|
|
|
private javax.swing.JRadioButton BtnServer;
|
|
|
|
private javax.swing.JDialog dialogChooseMode;
|
|
|
|
private ChatProgramm.view.GrafikView gvZeichenflaeche;
|
|
|
|
private javax.swing.JPanel jPanel1;
|
|
|
|
private javax.swing.JLabel lblMode;
|
|
|
|
// End of variables declaration//GEN-END:variables
|
2023-12-18 10:24:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the BtnClient
|
|
|
|
*/
|
|
|
|
public javax.swing.JRadioButton getBtnClient()
|
|
|
|
{
|
|
|
|
return BtnClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the BtnConnect
|
|
|
|
*/
|
|
|
|
public javax.swing.JButton getBtnConnect()
|
|
|
|
{
|
|
|
|
return BtnConnect;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the BtnGrpMode
|
|
|
|
*/
|
|
|
|
public javax.swing.ButtonGroup getBtnGrpMode()
|
|
|
|
{
|
|
|
|
return BtnGrpMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the BtnServer
|
|
|
|
*/
|
|
|
|
public javax.swing.JRadioButton getBtnServer()
|
|
|
|
{
|
|
|
|
return BtnServer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the jDialog1
|
|
|
|
*/
|
|
|
|
public javax.swing.JDialog getjDialog1()
|
|
|
|
{
|
|
|
|
return dialogChooseMode;
|
|
|
|
}
|
|
|
|
|
2023-12-18 11:21:08 +01:00
|
|
|
// /**
|
|
|
|
// * @return the tfNachricht
|
|
|
|
// */
|
|
|
|
// public javax.swing.JTextField getTfNachricht()
|
|
|
|
// {
|
|
|
|
// return tfNachricht;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
// * @return the txtChat
|
|
|
|
// */
|
|
|
|
// public javax.swing.JTextArea getTxtChat()
|
|
|
|
// {
|
|
|
|
// return txtChat;
|
|
|
|
// }
|
2023-12-18 10:24:38 +01:00
|
|
|
}
|