From 409934c2c92f4c687b2aa943ae2bf88fd6638d0d Mon Sep 17 00:00:00 2001 From: Holger Bergunde Date: Wed, 29 Jun 2011 09:22:03 +0000 Subject: [PATCH] SPARK-1398 fixed UiThreadViolation in scrollToBottom git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12550 b35dd754-fafc-0310-a699-88a17e54d16e --- src/java/org/jivesoftware/spark/ui/ChatRoom.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/java/org/jivesoftware/spark/ui/ChatRoom.java b/src/java/org/jivesoftware/spark/ui/ChatRoom.java index 2c4ce2cd5..1f0cc210c 100644 --- a/src/java/org/jivesoftware/spark/ui/ChatRoom.java +++ b/src/java/org/jivesoftware/spark/ui/ChatRoom.java @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -616,8 +617,15 @@ public void scrollToBottom() { transcriptWindow.setCaretPosition(lengthOfChat); try { - JScrollBar scrollBar = textScroller.getVerticalScrollBar(); - scrollBar.setValue(scrollBar.getMaximum()); + final JScrollBar scrollBar = textScroller.getVerticalScrollBar(); + EventQueue.invokeLater(new Runnable() { + + @Override + public void run() { + scrollBar.setValue(scrollBar.getMaximum()); + } + }); + } catch (Exception e) {