|
@ -103,12 +103,7 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void initGui() { |
|
|
private void initGui() { |
|
|
outputTextArea = new JTextArea(); |
|
|
|
|
|
outputTextArea.setEditable(false); |
|
|
|
|
|
outputTextArea.setBorder(BorderFactory.createTitledBorder("Chat")); |
|
|
|
|
|
outputTextArea.setBackground(Color.lightGray); |
|
|
|
|
|
|
|
|
|
|
|
outputScrollPane = new JScrollPane(outputTextArea); |
|
|
|
|
|
|
|
|
prepareOutputTextArea(); |
|
|
|
|
|
|
|
|
timeLabel = new JLabel(); |
|
|
timeLabel = new JLabel(); |
|
|
updateTime(); |
|
|
updateTime(); |
|
@ -126,6 +121,16 @@ public class ChatClient extends JFrame implements KeyListener { |
|
|
setDefaultCloseOperation(EXIT_ON_CLOSE); |
|
|
setDefaultCloseOperation(EXIT_ON_CLOSE); |
|
|
setLocationRelativeTo(null); |
|
|
setLocationRelativeTo(null); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void prepareOutputTextArea() { |
|
|
|
|
|
outputTextArea = new JTextArea(); |
|
|
|
|
|
outputTextArea.setEditable(false); |
|
|
|
|
|
outputTextArea.setBorder(BorderFactory.createTitledBorder("Chat")); |
|
|
|
|
|
outputTextArea.setBackground(Color.lightGray); |
|
|
|
|
|
|
|
|
|
|
|
outputScrollPane = new JScrollPane(outputTextArea); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void receiveMessages() { |
|
|
private void receiveMessages() { |
|
|
try { |
|
|
try { |
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|
connectionToServer = new Socket(address, Constants.PORT); |
|
|