|
@ -104,15 +104,12 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
|
|
|
|
|
|
private void initGui() { |
|
|
private void initGui() { |
|
|
prepareOutputTextArea(); |
|
|
prepareOutputTextArea(); |
|
|
|
|
|
createInputTextField(); |
|
|
|
|
|
|
|
|
timeLabel = new JLabel(); |
|
|
timeLabel = new JLabel(); |
|
|
updateTime(); |
|
|
updateTime(); |
|
|
add(timeLabel, BorderLayout.NORTH); |
|
|
add(timeLabel, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
inputTextField = new JTextField(); |
|
|
|
|
|
inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben")); |
|
|
|
|
|
inputTextField.addKeyListener(this); |
|
|
|
|
|
|
|
|
|
|
|
add(outputScrollPane, BorderLayout.CENTER); |
|
|
add(outputScrollPane, BorderLayout.CENTER); |
|
|
add(inputTextField, BorderLayout.SOUTH); |
|
|
add(inputTextField, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
@ -131,6 +128,12 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
outputScrollPane = new JScrollPane(outputTextArea); |
|
|
outputScrollPane = new JScrollPane(outputTextArea); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void createInputTextField() { |
|
|
|
|
|
inputTextField = new JTextField(); |
|
|
|
|
|
inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben")); |
|
|
|
|
|
inputTextField.addKeyListener(this); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void receiveMessages() { |
|
|
private void receiveMessages() { |
|
|
try { |
|
|
try { |
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|