Insert text at abitrary point in a JTextPane
This is my first post on this forum though I have read it many times to solve problems I've been having, so thanks everyone :)
I have a question regarding the JTextPane, and if it's possible to insert text at any point in it? i.e. to be able to 'click-and-type' as with something like Word, and then start writing at that point regardless of whether there is text before or not.
I looked around for a long time to try and find an answer for this but so far have not had any luck. I thought it would be a case of moving the caret to the new position but the caret can't be moved past the text already in the pane. I want to for example be able to create a new pane and start typing in the middle. Is this possible?
I've managed to accomplish this so far by flooding the pane with spaces when I create it, but it seems to be a bit of a hack and I'm sure there must be a better way!
Any help would be really appreciated :)