Init mit Aufgabe10

This commit is contained in:
2023-12-18 10:24:38 +01:00
commit 22efa7c18f
22 changed files with 3188 additions and 0 deletions
+151
View File
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JDialog" name="dialogChooseMode">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[278, 208]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
<Property name="columns" type="int" value="1"/>
<Property name="rows" type="int" value="0"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="lblMode">
<Properties>
<Property name="text" type="java.lang.String" value=" Choose your mode:"/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="BtnServer">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="BtnGrpMode"/>
</Property>
<Property name="text" type="java.lang.String" value="Server"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BtnServerActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="BtnClient">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="BtnGrpMode"/>
</Property>
<Property name="text" type="java.lang.String" value="Client"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BtnClientActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="65" max="32767" attributes="0"/>
<Component id="BtnConnect" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="76" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="BtnConnect" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="57" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="BtnConnect">
<Properties>
<Property name="text" type="java.lang.String" value="Connect"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BtnConnectActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.ButtonGroup" name="BtnGrpMode">
</Component>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[568, 548]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<Events>
<EventHandler event="windowOpened" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowOpened"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="javax.swing.JTextField" name="tfNachricht">
<Properties>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tfNachrichtMouseClicked"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="tfNachrichtActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Last"/>
</Constraint>
</Constraints>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[238, 150]"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="txtChat">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" value="Chat:"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
+285
View File
@@ -0,0 +1,285 @@
/*
* 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
{
/**
* 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()
{
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();
tfNachricht = new javax.swing.JTextField();
jScrollPane2 = new javax.swing.JScrollPane();
txtChat = new javax.swing.JTextArea();
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);
}
});
tfNachricht.setToolTipText("");
tfNachricht.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mouseClicked(java.awt.event.MouseEvent evt)
{
tfNachrichtMouseClicked(evt);
}
});
tfNachricht.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
tfNachrichtActionPerformed(evt);
}
});
getContentPane().add(tfNachricht, java.awt.BorderLayout.PAGE_END);
jScrollPane2.setPreferredSize(new java.awt.Dimension(238, 150));
txtChat.setColumns(20);
txtChat.setRows(5);
txtChat.setText("Chat:");
jScrollPane2.setViewportView(txtChat);
getContentPane().add(jScrollPane2, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
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 tfNachrichtActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_tfNachrichtActionPerformed
{//GEN-HEADEREND:event_tfNachrichtActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_tfNachrichtActionPerformed
private void formWindowOpened(java.awt.event.WindowEvent evt)//GEN-FIRST:event_formWindowOpened
{//GEN-HEADEREND:event_formWindowOpened
dialogChooseMode.show();
}//GEN-LAST:event_formWindowOpened
private void tfNachrichtMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_tfNachrichtMouseClicked
{//GEN-HEADEREND:event_tfNachrichtMouseClicked
}//GEN-LAST:event_tfNachrichtMouseClicked
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);
}
});
}
// 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 javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JLabel lblMode;
private javax.swing.JTextField tfNachricht;
private javax.swing.JTextArea txtChat;
// End of variables declaration//GEN-END:variables
/**
* @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;
}
/**
* @return the tfNachricht
*/
public javax.swing.JTextField getTfNachricht()
{
return tfNachricht;
}
/**
* @return the txtChat
*/
public javax.swing.JTextArea getTxtChat()
{
return txtChat;
}
}