Watching YouTube in NetBeans IDE 6.0
By Geertjan-Oracle on Dec 04, 2007
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.