Browse Source

Refactor: Use showCurrentTime method

remotes/origin/hotfix/client/improve-chat-window-appearence
Alena Bandarovich 11 months ago
parent
commit
2810433d0c
  1. 11
      src/main/java/ChatClient.java

11
src/main/java/ChatClient.java

@ -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);

Loading…
Cancel
Save