Browse Source

add input and output areas in GUI window

remotes/origin/feature/client/exchange-messages-between-client-server
Alena Bandarovich 11 months ago
parent
commit
1e3e1ffe4a
  1. 10
      src/main/java/ChatClient.java

10
src/main/java/ChatClient.java

@ -7,6 +7,10 @@ public class ChatClient extends JFrame {
private int port;
private Socket connectionToServer;
// GUI
private JTextArea outputTextArea;
private JTextField inputTextField;
public ChatClient(int port) {
super("Chat");
this.port = port;
@ -18,6 +22,12 @@ public class ChatClient extends JFrame {
}
private void initGui() {
outputTextArea = new JTextArea();
inputTextField = new JTextField();
add(outputTextArea);
add(inputTextField);
setVisible(true);
setSize(800, 600);
setDefaultCloseOperation(EXIT_ON_CLOSE);

Loading…
Cancel
Save