• Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestFocus()

 
Vanitha Sugumaran
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
to enable keyboard events do we have to override isRequestFocusEnable() and requestFocus()?
I used only isFocusEnable() it worked, but then when I wanted to
try the same program in another computer, with only isFocus..() it didn't work.
Vanitha
 
Matt Robinson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is true the component you want to enable key events on should have the focus. There is also a component method called enableEvents which takes an event type as an argument... that is a simple, basic way to enable events on a component if they aren't by default.
------------------
Matthew Robinson co-author of "Swing" (1999, Manning Publications). Freely available at http://www.spindoczine.com/sbe
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!