From f95ae10d03e43fe845a9c2f850b6744396bc13e0 Mon Sep 17 00:00:00 2001 From: Matt Jenkins Date: Sun, 2 Feb 2020 19:07:23 +0000 Subject: [PATCH] Fix new chapter adding at top of tree --- src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java index 5d39c29..2efedf5 100644 --- a/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java +++ b/src/uk/co/majenko/audiobookrecorder/AudiobookRecorder.java @@ -2155,9 +2155,7 @@ public class AudiobookRecorder extends JFrame implements DocumentListener { public void addChapter() { Debug.trace(); Chapter c = book.addChapter(); - Chapter lc = book.getLastChapter(); - int i = bookTreeModel.getIndexOfChild(book, lc); - bookTreeModel.insertNodeInto(c, book, i+1); + bookTreeModel.insertNodeInto(c, book, book.getChildCount()); bookTree.scrollPathToVisible(new TreePath(c.getPath())); }