GeoExt.LegendPanel

This example shows the how to create a LegendPanel that autopopulates with legends from a map that has already been created.

The js is not minified so it is readable. See legendpanel.js.