• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable -> listening to keyevents on the header  RSS feed

 
el duente
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to listen to keyevents on the JTableHeader of a JTable by adding a keyListener directly on it but it seems not to work...
As told in Sun Swing tutorial, only components with keyboard focus can send such events. So I tried to force the focus on the header but this didn't work either...
The only workaround I found was to override addKeyListener() on the header to register the listener to the parent JTable instead of the header itself...
The problem is I don't find this is a good solution... Has anybody tried this and has found a better way to achieve this ?
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!