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

how to setfocus to jframe on mouseEntered event  RSS feed

 
srinivas bolloju
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
my JFrame is in inactive state(i.e im moving my mouse from an another active jframe to this inactive jframe), when i enter mouse over/on it , i want to setfoucs to the jframe. Can anybody pls let me know how it can be achieved. I have tried using this.requestfocus(), this.show, this.visible, some options like this....on mouseEntered event of inactive jframe but it doesnt work . any help is appreciated.
 
Ajit Malleri
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try requestFocus() in the windowOpened method of windowListener interface.
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
This should do it...

Of course, You will need to change the references slightly to fit your program.
Best regards,
Abhik.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!