Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get Focus on JEditorPane  RSS feed

 
M.K.A. Monster
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
I'm building a texteditor. Just for the learning purpose. I've added some short-cut functions like: ctrl+s for saving and ctrl+n for a new document
When I press those key-combinations, the function works very well, but the trouble is, the JEditorPane has no longer focus.
When I change to an other window, and change back the JEditorPane has regained focus.
I've tried the requestFocus() method, but it didn't work for me.
Does anyone have a solution?
Yours,
Mark Monster
 
Remus Stratulat
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you coud have a problem with with the threads. I suppose that your saving is done by another thread.
try putting the focus request in a thread like this:

this coud help.
 
M.K.A. Monster
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your help, I'm going to try it. I hope it will work.
Yours,
Mark Monster
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!