diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index 7ff74a6..90966c8 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -103,12 +103,7 @@ public class ChatClient extends JFrame implements KeyListener { } private void initGui() { - outputTextArea = new JTextArea(); - outputTextArea.setEditable(false); - outputTextArea.setBorder(BorderFactory.createTitledBorder("Chat")); - outputTextArea.setBackground(Color.lightGray); - - outputScrollPane = new JScrollPane(outputTextArea); + prepareOutputTextArea(); timeLabel = new JLabel(); updateTime(); @@ -126,6 +121,16 @@ public class ChatClient extends JFrame implements KeyListener { setDefaultCloseOperation(EXIT_ON_CLOSE); setLocationRelativeTo(null); } + + private void prepareOutputTextArea() { + outputTextArea = new JTextArea(); + outputTextArea.setEditable(false); + outputTextArea.setBorder(BorderFactory.createTitledBorder("Chat")); + outputTextArea.setBackground(Color.lightGray); + + outputScrollPane = new JScrollPane(outputTextArea); + } + private void receiveMessages() { try { connectionToServer = new Socket(address, Constants.PORT);