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