The issue is that you're trying to use it in a static context, and since the inner class is not static itself, it needs an instance of the enclosing class for it to exist -- i.e., it needs to be constructed on that enclosing instance. This will lead to some funny/ugly code such as
MathWindowStateListener wsListener = mg.new MathWindowStateListener();
Better to make the private inner class static
and this will solve your problem without resorting to the above kludge.