• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to traversal focus in JTable

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic