Browse Source

Add auto scroll to end

remotes/origin/feature/client/exchange-messages-between-client-server
Alena Bandarovich 11 months ago
parent
commit
6d9cb97cba
  1. 1
      src/main/java/ChatClient.java

1
src/main/java/ChatClient.java

@ -56,6 +56,7 @@ public class ChatClient extends JFrame implements KeyListener {
while (true) { while (true) {
String message = fromServerReader.readLine(); String message = fromServerReader.readLine();
outputTextArea.append(message + "\n"); outputTextArea.append(message + "\n");
outputScrollPane.getVerticalScrollBar().setValue(outputScrollPane.getVerticalScrollBar().getMaximum());
} }
} catch (IOException e) { } catch (IOException e) {
JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen."); JOptionPane.showMessageDialog(null, "Verbindung zum Server \"" + address + "\" fehlgeschlagen.");

Loading…
Cancel
Save