Browse Source

Logik für Eingabe-Ausgabe hinzugefügt

remotes/origin/server
Paul Kattenborn 11 months ago
parent
commit
e1ea0eaa79
  1. 7
      src/main/java/ChatGUI.java

7
src/main/java/ChatGUI.java

@ -50,6 +50,8 @@ public class ChatGUI implements ActionListener {
inputTextField.setPreferredSize(new Dimension(0, 30));
gui.add(inputTextField, BorderLayout.SOUTH);
inputTextField.addActionListener(this);
// Set the size of the GUI to be a quarter of the screen size
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int quarterWidth = screenSize.width / 2;
@ -68,7 +70,12 @@ public class ChatGUI implements ActionListener {
if (e.getSource() == exit) {
System.exit(0);
}
if (e.getSource() == inputTextField) {
String inputText = inputTextField.getText();
outputTextArea.append(inputText + "\n");
inputTextField.setText("");
}
}
}
Loading…
Cancel
Save