I am trying to find out how to only move 4 spaces forward in JTextArea, when pressing the 'tab' key on the keyboard. Currently it moves forward 8 spaces.
I've done some reading on Styles in Java and came across setLeftIndent() however this isn't what I need. I have thought about using a key listener so anytime 'tab' is pressed in JTextArea, it only moves forwards by 4 spaces (keybindings).
I would appreciate any advices.
Thanks.
You can use the
setTabSize(...)
method of JTextArea: