Why could be a possible reason for:
JTextPane p = new JTextPane();
p.setText("hello");
The exact code is rather long. So I'm not sure what parts I must show here.
It's something like:
Tab t = new Tab(jp1);
t.editortxt.setText("hello");
Tab
extends JPanel
and has in its constructor:
editortxt = new JTextPane();
i.e., editortxt
is a property of Tab
.
It throws this:
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:371)
at java.util.ArrayList.get(ArrayList.java:384)
I mean why would something so abstract throw when I use its own API?