Browse Source

Refactor: move window dimensions to a new Constants class

remotes/origin/feature/client/exchange-messages-between-client-server
Alena Bandarovich 11 months ago
parent
commit
d1c2f9e7a4
  1. 4
      src/main/java/ChatClient.java
  2. 4
      src/main/java/Constants.java

4
src/main/java/ChatClient.java

@ -6,8 +6,6 @@ import java.io.*;
import java.net.Socket; import java.net.Socket;
public class ChatClient extends JFrame implements KeyListener { 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 String address;
private int port; private int port;
private Socket connectionToServer; private Socket connectionToServer;
@ -44,7 +42,7 @@ public class ChatClient extends JFrame implements KeyListener {
add(inputTextField, BorderLayout.SOUTH); add(inputTextField, BorderLayout.SOUTH);
setVisible(true); setVisible(true);
setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
setSize(Constants.WINDOW_WIDTH, Constants.WINDOW_HEIGHT);
setDefaultCloseOperation(EXIT_ON_CLOSE); setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null); setLocationRelativeTo(null);
} }

4
src/main/java/Constants.java

@ -0,0 +1,4 @@
public class Constants {
public static final int WINDOW_WIDTH = 800;
public static final int WINDOW_HEIGHT = 600;
}
Loading…
Cancel
Save