Register the mouse listener so the dialog hides.

Fixes #7.