java.lang.IndexOutOfBoundsException: Index -1 out-of-bounds for length 9 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) at java.base/java.util.Objects.checkIndex(Objects.java:372) at java.base/java.util.ArrayList.get(ArrayList.java:440) at java.desktop/javax.swing.JTabbedPane.setTitleAt(JTabbedPane.java:1323) at scala.swing.TabbedPane$Page.title_$eq(TabbedPane.scala:42) at quanto.gui.ClosablePage.title_$eq(ClosableTabbedPane.scala:22) at quanto.gui.DocumentPage$$anonfun$1.applyOrElse(DocumentPage.scala:19) at quanto.gui.DocumentPage$$anonfun$1.applyOrElse(DocumentPage.scala:17) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:34) at scala.swing.Reactions$Impl.$anonfun$apply$1(Reactions.scala:24) at scala.swing.Reactions$Impl.$anonfun$apply$1$adapted(Reactions.scala:24) at scala.collection.immutable.List.foreach(List.scala:389) at scala.collection.generic.TraversableForwarder.foreach(TraversableForwarder.scala:35) at scala.collection.generic.TraversableForwarder.foreach$(TraversableForwarder.scala:35) at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:44) at scala.swing.Reactions$Impl.apply(Reactions.scala:24) at scala.swing.Reactions$Impl.apply(Reactions.scala:18) at scala.swing.Publisher.$anonfun$publish$1(Publisher.scala:46) at scala.swing.Publisher.$anonfun$publish$1$adapted(Publisher.scala:46) at scala.collection.Iterator.foreach(Iterator.scala:929) at scala.collection.Iterator.foreach$(Iterator.scala:929) at scala.swing.SingleRefCollection$$anon$4.foreach(Publisher.scala:108) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.swing.RefSet.foreach(Publisher.scala:165) at scala.swing.Publisher.publish(Publisher.scala:46) at scala.swing.Publisher.publish$(Publisher.scala:46) at quanto.gui.Document.publish(Document.scala:24) at quanto.gui.Document.$anonfun$save$2(Document.scala:59) at quanto.gui.Document.$anonfun$save$2$adapted(Document.scala:55) at scala.Option.foreach(Option.scala:257) at quanto.gui.Document.save(Document.scala:55) at quanto.gui.QuantoDerive$FileMenu$$anon$56.apply(QuantoDerive.scala:480) at scala.swing.Action$$anon$1.actionPerformed(Action.scala:78) at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369) at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:349) at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:935) at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810) at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2900) at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:699) at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:706) at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:706) at java.desktop/javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:677) at java.desktop/javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:311) at java.desktop/javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:297) at java.desktop/javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2993) at java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:2985) at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2862) at java.desktop/java.awt.Component.processEvent(Component.java:6366) at java.desktop/java.awt.Container.processEvent(Container.java:2261) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4966) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798) at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1950) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:871) at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1140) at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1010) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:836) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4847) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2319) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4798) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue.access$600(EventQueue.java:97) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)