Browse Source

Du alter pfuscher - Titel und zentriertes Öffnen über GUI Generator

master
Gerhard Switalski 5 years ago
parent
commit
34e1e4d2ed
3 changed files with 123 additions and 116 deletions
  1. 0
    1
      src/chatprogramm/Start.java
  2. 2
    1
      src/chatprogramm/view/ChatView.form
  3. 121
    114
      src/chatprogramm/view/ChatView.java

+ 0
- 1
src/chatprogramm/Start.java View File

@@ -26,7 +26,6 @@ public class Start {
ReceiveAdapterController rxAdapter = new ReceiveAdapterController(view);
model.addObserver(rxAdapter);
view.setTitle("ICQ 0.1 xD");
view.setVisible(true);
}

+ 2
- 1
src/chatprogramm/view/ChatView.form View File

@@ -7,10 +7,11 @@
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="ICQ 0.1 xD"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>

+ 121
- 114
src/chatprogramm/view/ChatView.java View File

@@ -94,118 +94,125 @@ public class ChatView extends javax.swing.JFrame {
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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();
}// </editor-fold>//GEN-END:initComponents
pack();
setLocationRelativeTo(null);
}// </editor-fold>//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
}

Loading…
Cancel
Save