Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedding .avi in JavaHelp?

I'm creating some help content for an application (built on NetBeans), and thought it would be useful in some cases to be able do show a tutorial video within the JavaHelp or have a link to open a video.

I'd imagine it would be possible using the <OBJECT> tag perhaps, but I don't know which object to embed. What little I know of JavaHelp I've gotten from http://download.java.net/javadesktop/javahelp/jhug.pdf, and from that I conclude that I should get some Lightweight Java Component capable of playing a .avi and embed it with the <object> tag. Or rather have a link in the help that opens the .avi in a seperate window.

Does anyone have any pointers on how this is done?

Edit:

I've tried some more on adding a lightweight component of my own, but to no success. So I wonder if I'm placing the component in the wrong place. If i try to add a JButton to the JavaHelp with

 <object 
     classid="java:javax.swing.JButton">
 </object>

it appears in the JavaHelp just fine.

if I try a button of my own, like

 <object 
     classid="java:my.module.TestButton">
 </object>

I just get a couple of red "???"

The class TestBytton is just

package my.module;

import javax.swing.JButton;

public class TestButton extends JButton{

}

The TestButton lies in the same NetBeans project as the javahelp-html, and the package the TestButton lies in is public. Any ideas?

Edit2: Ok, so i've looked into this some more. It seems that eventually the class com.sun.java.help.impl.CustomKit$CustomDocument will try to do a

getClass().getClassLoader().loadClass("my.module.TestButton")

And that will result in a ClassNotFoundException. That might be if i understood it correctly because the classloader that will be used will only find classes that are in the netbeans module called JavaHelp Integration. And among those are not my.module.TestButton. So... I'm stuck once more. I don't think i can add anything to that module easily.

.

like image 280
bjarven Avatar asked Oct 18 '11 09:10

bjarven


1 Answers

I do not know of any way to embed video in JavaHelp this way. But you should be able to create a regular hyperlink to an HTML file embedding the video (in some manner), for use from an external browser. http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-javahelp/org/netbeans/api/javahelp/doc-files/api.html#external-links shows how to make the links.

If you want this to work offline, include the HTML in your NBM fileset and use the nbinst URL protocol; for example, if in release/docs/helpvid.html in sources (for an Ant-based NBM project), nbinst://my.module.code.name.base/docs/helpvid.html should link to it in the app's installation. As far as I know the JavaHelp module's link handler will convert the URL to an equivalent file-protocol URL before passing it to the configured web browser (defaulting to Desktop.browse on JDK 6+).

like image 73
Jesse Glick Avatar answered Oct 02 '22 07:10

Jesse Glick