You may find the Cassowary Constraint Solver of interest. I've reworked the libraries and an example program for Java 5+ compatibility. I'll be releasing the revised sources soon via the original authors, Greg Badros and Alan Borning.
I took an interest in constraint solvers in the early 1980s and was especially interested in the work of Alan Borning and his students as it relates to computer graphics.