From 34e1e4d2ed7579bd0ff0e1156a98dceb98f7fda6 Mon Sep 17 00:00:00 2001 From: Gerhard Switalski Date: Sat, 5 Jan 2019 14:57:35 +0100 Subject: [PATCH] =?UTF-8?q?Du=20alter=20pfuscher=20-=20Titel=20und=20zentr?= =?UTF-8?q?iertes=20=C3=96ffnen=20=C3=BCber=20GUI=20Generator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chatprogramm/Start.java | 1 - src/chatprogramm/view/ChatView.form | 3 +- src/chatprogramm/view/ChatView.java | 235 ++++++++++++++-------------- 3 files changed, 123 insertions(+), 116 deletions(-) diff --git a/src/chatprogramm/Start.java b/src/chatprogramm/Start.java index 49581c2..c80cc23 100644 --- a/src/chatprogramm/Start.java +++ b/src/chatprogramm/Start.java @@ -26,7 +26,6 @@ public class Start { ReceiveAdapterController rxAdapter = new ReceiveAdapterController(view); model.addObserver(rxAdapter); - view.setTitle("ICQ 0.1 xD"); view.setVisible(true); } diff --git a/src/chatprogramm/view/ChatView.form b/src/chatprogramm/view/ChatView.form index fa1ac70..a34bff9 100644 --- a/src/chatprogramm/view/ChatView.form +++ b/src/chatprogramm/view/ChatView.form @@ -7,10 +7,11 @@ + - + diff --git a/src/chatprogramm/view/ChatView.java b/src/chatprogramm/view/ChatView.java index 6a551e0..a40e4f9 100644 --- a/src/chatprogramm/view/ChatView.java +++ b/src/chatprogramm/view/ChatView.java @@ -94,118 +94,125 @@ public class ChatView extends javax.swing.JFrame { * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { + // //GEN-BEGIN:initComponents + private void initComponents() + { - bgSelect = new javax.swing.ButtonGroup(); - jScrollPane1 = new javax.swing.JScrollPane(); - taCommunication = new javax.swing.JTextArea(); - tfMessage = new javax.swing.JTextField(); - btSend = new javax.swing.JButton(); - tfPort = new javax.swing.JTextField(); - lbPort = new javax.swing.JLabel(); - lbIP = new javax.swing.JLabel(); - tfIP = new javax.swing.JTextField(); - btConnect = new javax.swing.JButton(); - rbClient = new javax.swing.JRadioButton(); - rbServer = new javax.swing.JRadioButton(); - jSeparator2 = new javax.swing.JSeparator(); + bgSelect = new javax.swing.ButtonGroup(); + jScrollPane1 = new javax.swing.JScrollPane(); + taCommunication = new javax.swing.JTextArea(); + tfMessage = new javax.swing.JTextField(); + btSend = new javax.swing.JButton(); + tfPort = new javax.swing.JTextField(); + lbPort = new javax.swing.JLabel(); + lbIP = new javax.swing.JLabel(); + tfIP = new javax.swing.JTextField(); + btConnect = new javax.swing.JButton(); + rbClient = new javax.swing.JRadioButton(); + rbServer = new javax.swing.JRadioButton(); + jSeparator2 = new javax.swing.JSeparator(); - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + setTitle("ICQ 0.1 xD"); - taCommunication.setColumns(20); - taCommunication.setRows(5); - jScrollPane1.setViewportView(taCommunication); + taCommunication.setColumns(20); + taCommunication.setRows(5); + jScrollPane1.setViewportView(taCommunication); - btSend.setText("send"); + btSend.setText("send"); - tfPort.setText("45000"); - tfPort.setToolTipText(""); + tfPort.setText("45000"); + tfPort.setToolTipText(""); - lbPort.setText("Port:"); - lbPort.setToolTipText(""); + lbPort.setText("Port:"); + lbPort.setToolTipText(""); - lbIP.setText("IP:"); + lbIP.setText("IP:"); - tfIP.setText("127.0.0.1"); + tfIP.setText("127.0.0.1"); - btConnect.setText("connect"); - btConnect.setToolTipText(""); + btConnect.setText("connect"); + btConnect.setToolTipText(""); - bgSelect.add(rbClient); - rbClient.setSelected(true); - rbClient.setText("Client"); - rbClient.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - rbClientActionPerformed(evt); - } - }); + bgSelect.add(rbClient); + rbClient.setSelected(true); + rbClient.setText("Client"); + rbClient.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(java.awt.event.ActionEvent evt) + { + rbClientActionPerformed(evt); + } + }); - bgSelect.add(rbServer); - rbServer.setText("Server"); - rbServer.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - rbServerActionPerformed(evt); - } - }); + bgSelect.add(rbServer); + rbServer.setText("Server"); + rbServer.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(java.awt.event.ActionEvent evt) + { + rbServerActionPerformed(evt); + } + }); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addComponent(lbPort) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tfPort, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(lbIP) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tfIP, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 247, Short.MAX_VALUE) - .addComponent(btConnect)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addComponent(rbClient, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rbServer) - .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(jScrollPane1) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addComponent(tfMessage) - .addGap(18, 18, 18) - .addComponent(btSend))) - .addContainerGap()) - .addComponent(jSeparator2) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(tfMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btSend)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(1, 1, 1) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(rbServer) - .addComponent(rbClient)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lbPort) - .addComponent(tfPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(tfIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(lbIP) - .addComponent(btConnect)) - .addContainerGap()) - ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(lbPort) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tfPort, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(lbIP) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(tfIP, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 247, Short.MAX_VALUE) + .addComponent(btConnect)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(rbClient, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(rbServer) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(jScrollPane1) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() + .addComponent(tfMessage) + .addGap(18, 18, 18) + .addComponent(btSend))) + .addContainerGap()) + .addComponent(jSeparator2) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE) + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(tfMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btSend)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(1, 1, 1) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(rbServer) + .addComponent(rbClient)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(lbPort) + .addComponent(tfPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(tfIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(lbIP) + .addComponent(btConnect)) + .addContainerGap()) + ); - pack(); - }// //GEN-END:initComponents + pack(); + setLocationRelativeTo(null); + }// //GEN-END:initComponents private void rbClientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbClientActionPerformed // TODO add your handling code here: @@ -250,19 +257,19 @@ public class ChatView extends javax.swing.JFrame { }); } - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.ButtonGroup bgSelect; - private javax.swing.JButton btConnect; - private javax.swing.JButton btSend; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JSeparator jSeparator2; - private javax.swing.JLabel lbIP; - private javax.swing.JLabel lbPort; - private javax.swing.JRadioButton rbClient; - private javax.swing.JRadioButton rbServer; - private javax.swing.JTextArea taCommunication; - private javax.swing.JTextField tfIP; - private javax.swing.JTextField tfMessage; - private javax.swing.JTextField tfPort; - // End of variables declaration//GEN-END:variables + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.ButtonGroup bgSelect; + private javax.swing.JButton btConnect; + private javax.swing.JButton btSend; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JSeparator jSeparator2; + private javax.swing.JLabel lbIP; + private javax.swing.JLabel lbPort; + private javax.swing.JRadioButton rbClient; + private javax.swing.JRadioButton rbServer; + private javax.swing.JTextArea taCommunication; + private javax.swing.JTextField tfIP; + private javax.swing.JTextField tfMessage; + private javax.swing.JTextField tfPort; + // End of variables declaration//GEN-END:variables }