File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get focus on JMenuBar in JFrame

 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am having trouble getting focus on JMenuBar in a JFrame at the start up of my application.i have tried
grabFocus()
requestFocus()
jMenuBar.setRequestFocusEnabled(true) in a Window opening event of window listener ,nothing seems to be working.
like to have some tips
thanks,
harcharan
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess you can simple achieve it by pressing F10 key on the keyboard.if i am not wrong, do we specify keyboard operations on the application in our user documentation.
any comments
thanks
 
parthiban subramaniam
Ranch Hand
Posts: 116
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
why do you need to get the foucs on to the menubar anyways ??..i dont think any application does that when it start's up ..

hmm am not sure abut the f10 key it might be specific to windows ..
cheers,
parthi
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was just testing ,if somebody wants to use keyboard instead of a mouse,do you have any thoughts about this.yes i am developing on windows.any thoughts about this thought.
thanks
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harcharan,

So now if the user presses ALT+(mnemonic for parent menu)ALT+B or by simply pressing CTRL+B then the book item will be selected.
Hope this helps,
Michael Morris
[ September 25, 2002: Message edited by: Michael Morris ]
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Michael,
do we specify keyboard operations on the application in our user documentation.
thanks!
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi harcharan,

do we specify keyboard operations on the application in our user documentation.

I did and I think you would be remiss if you did not mention it.
Michael Morris
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a list of supported key shortcuts for menus: http://java.sun.com/products/jlf/ed2/book/Appendix.A9.html
I recommend to read (or at least skim) through the (free) Java Look & Feel design guidelines. You may learn a lot about how to make usable and ergonomic GUIs. Also, the quality of the GUI you will produce with the kind of information contained within this book is far better than the one you would get from any IDE in my opinion.
This is not required for SCJD but if you are planning on taking your time anyway, why not reading this book.
 
harcharan kanwal
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks valentin ,surely look into this
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic