Why Another GUI

Given Swing, why have yet another widget set? fits better with gui as specialized document rather than document special widget GUI widgets independent typically have one or more big panes that show "document" of some kind: word processor, spreadsheet, 3D CAD, whatever. GUI widgets just special document elements with special behavior to mouse clicks use same layout

  1. Widgets can be layed out and have rich content just like the rest of the document because content and layout are the same as for the rest of the document. For example, we can have images and attributed text mixed in a menu item, and a menu can use a 2D table of buttons or arbitrary HTML fragments, or even I suppose an embedded scanned page images. scanned page image--with no extra work in the GUI widget.
  2. Widgets integrate well with the rest of the document (because they are all what Swing calls lightweight). Compare this to platform-native widgets in Netscape, where scrolling a big form distinctly scrolls the widgets separately from the rest of the document).
  3. It's easy to add new widgets with little code. Easy because they can compose multiple other node types, not just inherit from one. As for code size, at one time the set of implemented widgets--including button, checkbox, radiobox, menu, menubutton, scrollbar, textarea, entry-- needed just over 1000 lines of code (it is now ~2500 lines—still tiny).
  4. Widgets can be scripted, though right now the homebrew {@link util.VScript} is just powerful enough to run HTML. We'll be supporting JavaScript, only because it is so popular and not due to technical quality, if any. One could add other scripting languages, such as Tcl, which has an implementation in Java.