Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Hotkeys and launching HTML file

 
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
 
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).]
 
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
 
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
 
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic