I have a JTextArea were I am trying to implement a block shift left/right on selected text. I have a KeyListener on the JTextArea where I check for the left or right arrow key. I process the left/right event ok, move my text, but then the text becomes unselected. I have added code to reselect it before I exit and also to make sure the text area still has focus but no luck. I did notice that after a left/right arrow I also get a KeyEvent.VK_ALT event. I am not sure why I am getting that but added code to reselect the text for this key event also. A code snippet of 'reselecting' the text is below
try posting a compilable program - nothing fancy, just a frame/textArea and the block shift code,
along with explanation 'if you do this, it should do that, but instead...'