Browse Source

Refactor: Create input text field from new method

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

11
src/main/java/ChatClient.java

@ -104,15 +104,12 @@ public class ChatClient extends JFrame implements KeyListener {
private void initGui() {
prepareOutputTextArea();
createInputTextField();
timeLabel = new JLabel();
updateTime();
add(timeLabel, BorderLayout.NORTH);
inputTextField = new JTextField();
inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben"));
inputTextField.addKeyListener(this);
add(outputScrollPane, BorderLayout.CENTER);
add(inputTextField, BorderLayout.SOUTH);
@ -131,6 +128,12 @@ public class ChatClient extends JFrame implements KeyListener {
outputScrollPane = new JScrollPane(outputTextArea);
}
private void createInputTextField() {
inputTextField = new JTextField();
inputTextField.setBorder(BorderFactory.createTitledBorder("Nachricht eingeben"));
inputTextField.addKeyListener(this);
}
private void receiveMessages() {
try {
connectionToServer = new Socket(address, Constants.PORT);

Loading…
Cancel
Save