|
|
@ -105,13 +105,11 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
|
private void initGui() { |
|
|
|
prepareOutputTextArea(); |
|
|
|
createInputTextField(); |
|
|
|
|
|
|
|
timeLabel = new JLabel(); |
|
|
|
updateTime(); |
|
|
|
add(timeLabel, BorderLayout.NORTH); |
|
|
|
showCurrentTime(); |
|
|
|
|
|
|
|
add(outputScrollPane, BorderLayout.CENTER); |
|
|
|
add(inputTextField, BorderLayout.SOUTH); |
|
|
|
add(timeLabel, BorderLayout.NORTH); |
|
|
|
|
|
|
|
setVisible(true); |
|
|
|
setSize(Constants.WINDOW_WIDTH, Constants.WINDOW_HEIGHT); |
|
|
@ -134,6 +132,11 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
|
inputTextField.addKeyListener(this); |
|
|
|
} |
|
|
|
|
|
|
|
private void showCurrentTime(){ |
|
|
|
timeLabel = new JLabel(); |
|
|
|
updateTime(); |
|
|
|
} |
|
|
|
|
|
|
|
private void receiveMessages() { |
|
|
|
try { |
|
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|
|