From 9adf4d68c15eaa4b432978b7c959189e1a49655f Mon Sep 17 00:00:00 2001 From: Alena Bandarovich Date: Wed, 7 Feb 2024 20:00:53 +0100 Subject: [PATCH] Refactor: make window height and width constant --- src/main/java/ChatClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/ChatClient.java b/src/main/java/ChatClient.java index f39bc2f..2cfdfd0 100644 --- a/src/main/java/ChatClient.java +++ b/src/main/java/ChatClient.java @@ -6,6 +6,8 @@ import java.io.*; import java.net.Socket; public class ChatClient extends JFrame implements KeyListener { + private static final int WINDOW_WIDTH = 800; + private static final int WINDOW_HEIGHT = 600; private String address; private int port; private Socket connectionToServer; @@ -42,7 +44,7 @@ public class ChatClient extends JFrame implements KeyListener { add(inputTextField, BorderLayout.SOUTH); setVisible(true); - setSize(800, 600); + setSize(WINDOW_WIDTH, WINDOW_HEIGHT); setDefaultCloseOperation(EXIT_ON_CLOSE); } private void receiveMessages() {