Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

tool barrrrrr  RSS feed

 
kumar mars
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am facing peculiar problems
i have a JFrame with a and JPanel attached to it .
i need to do editing operations on text printed in JPanel.
i need a tool bar and i tried adding it to JFrame and JPanel
but in both cases i got a problem
the focus for the arrow keys and space bar is taken up the tool bar.
once i click on JPanel the focus of key board need to be completlt be back to JPanel it is not happenning.
The Keylistner is added to JFrame
where is the problem and how can i rectify it

 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar,
If I am understanding you correctly, you just need to add your panel as a mouse listener so that you can request the keyboard focus when user clicks in it. The code below might help you out.

Enjoy,
Manfred.
 
kumar mars
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi manfred
i tried ur method and got my problem solved
thanks for help
 
kumar mars
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi manfred
i tried ur method and got my problem solved
thanks for help
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!