Hola , estoy haciendo una ventana de ayuda con JavaHelp y me sale esto al hacer clic en el JMenuItem de ayuda, la primera vez no, pero despues todo el tiempo. Además no me funciona con un clic, sino que tengo que dar dos clic.
Esto es el error:
javax.help.InvalidHelpSetContextException: Wrong context
at javax.help.DefaultHelpModel.setCurrentID(DefaultHe lpModel.java:130)
at javax.help.DefaultHelpModel.setCurrentID(DefaultHe lpModel.java:103)
at javax.help.Presentation.setCurrentID(Presentation. java:150)
at javax.help.DefaultHelpBroker.setCurrentID(DefaultH elpBroker.java:362)
at javax.help.CSH.displayHelp(CSH.java:756)
at javax.help.CSH.access$200(CSH.java:88)
at javax.help.CSH$DisplayHelpFromSource.actionPerform ed(CSH.java:1676)
at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unk nown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mou seReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Esto es el código que utilizo para mi ventana:
private void ventanaAyuda() {
try {
// Carga el fichero de ayuda
File fichero = new File("src/help_set.hs");
URL hsURL = fichero.toURI().toURL();
// Crea el HelpSet y el HelpBroker
HelpSet helpset = new HelpSet(getClass().getClassLoader(), hsURL);
HelpBroker hb = helpset.createHelpBroker();
hb.enableHelpOnButton(ayudaItem, "aplicacion", helpset);
hb.enableHelpKey(f.getContentPane(), "ventana_principal",
helpset);
hb.enableHelpKey(f.getContentPane(), "ventana_secundaria",
helpset);
} catch (Exception e) {
e.printStackTrace();
}
}