Watching YouTube in NetBeans IDE 6.0

Managed to integrate the YouTube Player into the IDE. Unfortunately, because I'm using WebRenderer, a commercial web browser component, I can't distribute it. And I don't know whether I can distribute the Google API either. It was pretty cool to port the application to the NetBeans Platform, because it meant I was basically recreating it, thus optimizing the code as I went along the second time.

For example, there was no need for the Tidy API at all! In fact, I didn't need to do any HTML parsing. I wrote the temporary HTML file, inserted the short string that identifies YouTube movies, after extracting it from the movie's URL, and that's it. That's all that was needed. I didn't need that embedded element in the HTML at all, I could simply predefine it and insert the absolute minimum level of information into it.

Below is the result thus far. The user types something into the text field, presses Enter, and the list is populated with titles from YouTube containing the entered text. When an item in the list is double-clicked, a new window opens and the YouTube movie begins:

Another improvement is how WebRenderer is integrated. It is wonderfully simple. After the user double-clicks in the list (which is populated by the text field to its left, both of which can be seen in the screenshot above), the TopComponent opens. Then, code in the TopComponent loads the WebRenderer component, to which I pass the temporary file. The temporary file is recreated every time an item in the list is double-clicked, which is also the only time when the TopComponent opens (i.e., there's no menu item for opening it). And, whenever it opens, it loads the temporary file, which has new content each time. Wonderfully simple.

Pity I can't distribute it, though. Maybe I'll write a tutorial describing how you can do it yourself. That way, there'll be no licensing issues from my side, because you'll simply need to get whatever web browser component you like. For example, if JDIC works for you, you could get JDIC and plug it in. Not hard, as described above. Watch this space for a tutorial along these lines.


Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2016