Lets say that I have a table with ten rows and five columns. The default
tab order tabs through each cell, left to right, top to bottom.
How do I EXCLUDE the cells of the two leftmost columns from the tab
order?
Many thanks in advance, especially for any sample code.
> Lets say that I have a table with ten rows and five columns. The default
> tab order tabs through each cell, left to right, top to bottom.
> How do I EXCLUDE the cells of the two leftmost columns from the tab
> order?
I doubt it can be done but by rewriting the actions completely.
table.getInputMap().put("TAB", "tabForwards");
table.getInputMap().put("shift TAB", "tabBackwards");
table.getActionMap().put("tabForwards", new XXXAction());
table.getActionMap().put("tabBackwards", new YYYAction());
and do whatever you want to in XXXAction and YYYAction.
See BasicTableUI.NavigationalAction for inspiration.
Christian
[...]
> table.getInputMap().put("TAB", "tabForwards");
> table.getInputMap().put("shift TAB", "tabBackwards");
First replace "TAB" by KeyStroke.getKeyStroke("TAB") and so on.
Then you also (only?) need:
table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(...);
for both keys.
Christian