Purpose: This applet reads a Netscape bookmarks file and displays the corresponding menu, like the one in Netscape's toolbar.
The applet j1menu.java gets the parameters, displays a button and starts the menu loader.
MenuLoader runs in a new thread, adding to the menu items, submenus or separators to the menu. If the bookmark file (~64KB) is downloaded over the modem, clicking on the button will show the menu "growing".
BookmarkParser uses a TagGetter to retrieve tags between <brackets>, or inter-tag strings. Based on the fixed Netscape bookmark format, items, folders and separators are recognized. This code is not flexible, just enough to get the job done.
TagGetter reads one by one char from a Reader. Initially I wanted to use a StreamTokenizer for getting tags. But, like many of the early java library classes, it is quite useless, except for parsing Java code.
The file with bookmarks is opened and converted to a stream using
new InputStreamReader( new URL(getDocumentBase(), filename) .openStream()
After adding the button to the panel, j1menu applet calls validate() to paint itself, so it appears on the screen quite fast (<10 sec. over 56K modem, including opening a new window). All the other classes will start loading after the repainting.
A snippet of JavaScript code in opener.html browser window opens a small bookmarks window without toolbars or menus, containing only the applet. The bookmark window will then give opener's name to the applet, so a click on a menu item will open the corresponding web page in the opener window. A JavaScript in the opener names iteselt if it is an anonymous window.
The browser window is opened by hitting the form button on the opener page. At first, I wanted it to be opened automatically on load, but that would be too annoying. I prefer one more click than windows popping up when someone does not expect them.
I couldn't make the bookmark window smaller. I guess there is a limit on the minimal size of a browser window. Too bad.
Adding new bookmarks. Any suggestions of how to modify the bookmarks file on the server side (cgi-bin, perl, python) are welcome.
Bookmark editing applet.