# HG changeset patch # User David Barts # Date 1579367578 28800 # Node ID fb224c3aebdfae886d9e519817fe9e48aa243fcd # Parent be282c48010a88594e8cfc6c40b0d0491872cd28 Got it auto-scrolling to the bottom. diff -r be282c48010a -r fb224c3aebdf src/name/blackcap/clipman/PasteboardQueue.kt --- a/src/name/blackcap/clipman/PasteboardQueue.kt Tue Jan 14 14:07:19 2020 -0800 +++ b/src/name/blackcap/clipman/PasteboardQueue.kt Sat Jan 18 09:12:58 2020 -0800 @@ -5,8 +5,11 @@ package name.blackcap.clipman import java.awt.Container +import java.awt.Rectangle import java.util.Collections import java.util.LinkedList +import java.util.logging.Level +import java.util.logging.Logger import javax.swing.* /** @@ -33,11 +36,22 @@ } /** - * Add a JComponent to the end of the queue. - * @param item JComponent to add + * Add a QueueItem to the end of the queue. + * @param item QueueItem to add */ @Synchronized fun add(item: QueueItem) { - inSwingThread { parent.add(item.component) } + inSwingThread { + parent.add(item.component) + /* XXX - assumes there is a JScrollPane above us in the tree */ + var sp = parent.parent + while (sp != null && !(sp is JScrollPane)) { + sp = sp.parent + } + (sp as JScrollPane).run { + revalidate() + verticalScrollBar.run { value = maximum } + } + } queue.addLast(item) truncate(true) }