Monday, June 7, 2004

Buoy 1.0

Buoy is an interesting public-domain wrapper for Swing. It uses reflection to let you create Cocoa-style connections between event generators and event handlers, without the cruft of using interfaces and anonymous adapter classes. For instance, the Java:

widget.addEventLink(ActionEvent.class, obj, "doSomething");

is loosely equivalent to the Objective-C:

[widget setTarget:obj];
[widget setAction:@selector(doSomething:)];

Several benefits fall out of this design, and Buoy also makes other improvements to Swing. For instance, (like Cocoa) Buoy doesn’t generate events when you manipulate widgets programmatically.

I don’t write Swing code anymore, but if I did I’d surely want to use something like Buoy.

Comments RSS · Twitter

Leave a Comment