Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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
 
It's just like a fortune cookie, but instead of a cookie, it's pie. And we'll call it ... tiny ad:
The trailboss has a kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic