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