• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to traversal focus in JTable  RSS feed

 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks!!
I am using JTable and able to traverse the focus to all controls.
but problem is that focus goes to first column of table so how do i set the focus to desired column while traversing the focus.

i am using following code for traversing for Jtable

Action tabOut = new AbstractAction()
{
public void actionPerformed(ActionEvent ae)
{
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent();
}
};

Action tabIn = new AbstractAction()
{
public void actionPerformed(ActionEvent ae)
{
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusPreviousComponent();
}
};
mTable.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), "tabOut");
mTable.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 1), "tabIn");
mTable.getActionMap().put("tabIn", tabIn);
mTable.getActionMap().put("tabOut", tabOut);


that works fine but not able to focus on desired column, if any body have any clue please share with me
ThanX in advance!!!

Prashant Gour
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!