refactor: extract MouseInsideListener to a top level class
use MouseInsideListener in AutoHide
catch ClassCastExceptions for MacOS Applets