Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hotkeys and launching HTML file

 
Murphy Patrick
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,
Two questions:
1. How can I make a particular character a 'hotkey' in a JMenuItem. For example, I want x to be the hotkey for the Exit menu item. In most languages, an & prefix works. Doesn't work in Java.
2. I want to launch an HTML file from a menu item.
The file will be in the same folder as the classes. Which function can I use to open the HTML file?
The HTML file will contain the user documentation.
Thanks for any help.
-Pat
 
Bal Sharma
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let say we have JButton named Murphy. We want M as a hot key right! Following code gonna work.

That is it. I am not sure about number 2. BTW, are you talking about javadoc to launch HTML file? if so javadoc generates html files for each class. - Bal

[This message has been edited by Bal Sharma (edited November 13, 2001).]
 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As to your second question there is an easy way and a hard way.
The easy way:
Launch a new frame with a single JEditorPane. This can be used to display your html file.
The hard way:
Use Sun's JavaHelp System. Info available at http://java.sun.com/products/javahelp/index.html
 
Farouk Mohamed1
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
For an online help i used a tree pane on the left and an JEditor pane ont the left and a tree pane on the right
Look at the sun example for TreeDemo I think this is exactly what you want http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TreeDemoHelp.html

Farouk
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic