Hi fellow programmers!
I have a JEditorPane, where user is supposed to input series of numbers (quantities with optional uncertainities) separated by semicolons, for example:
3.0; 5.8; 70+-5; ...
The list is then mapped to ArrayList wrapper containing parsed quantities.
I'd like to implement a specific behaviour for input pane. For example pressing ';' or ' ' should insert '; ', pressing backspace/delete between ';' and ' ' should erase both of them and combine separated numbers. Cuts and pastes also have specific behaviour, and so on. I want it to be user-friendly and intuitive.
I tried DocumentFilter, but it seems to be too simple and it can mess up caret/selection. So I thought about writing my very own StyledEditorKit subclass, but there's a load of Actions to implement and a lot of technical details, which I am not certaing about.
How can I deal with it? Is there any way of doing it without writing EditorKit from scratch?