views:

24

answers:

1

In my JTable I have a number of actions that can accessed via popup menu or by selecting the configured shortcut. Selecting the action from the popup using mouse or keyboard is fine, and I can use the cursor keys to move to a field next to the original selection no problem. However if I use the shortcutkey instead it performs the action okay but I cannnot exit the selected fields afterwards using the cursor keys, because for some reason the focus is now with a component outside of the JTable.

EDIT:When I start the task I change the cursor and disable the JTable, when I complete the task I renable the table and reset the cursor. If I remove the disable code it works, but this then allow the user to make changes to the table which I dont want, and I cannot understand why it only fails when using keyboard shortcut.

A: 

Fixed the problem, after renabling the Jtable I needed to call requestFocusInWindow()

And no where in your original problem statement did you state you where enabling/disable the table, therefore we only had part of the information required to solve the problem. That is why a SSCCE should be posted with every question. Because until you solve the problem you don't know what information is or isn't relevant. Creating a SSCCE forces you to look at each step of the code to see if it is causing the problem or not.
camickr
camickr:Extracting a SSCCE can be alot of effort, of course creating an SSCCE would provide the answer many times and wouldnt require a post to this forum at all, but at the time I couldn't think where to start, the disabling table code was buried and I was hoping someone might have an idea of where to start