On 13 Mar 2006, at 21:03, GG wrote:
Removing and reinstalling mouse listeners would be one of the most
complicated solutions. Brute force is not the answer. It would
be far
simpler to subclass JFrame and JDialog to not send events (i.e.
consume
them before they're sent to listeners) when the window itself is
in the
hidden state. That is, add an event-filtering mechanism. Then you
only
have to tweak code in one place, instead of at every listener/sender
relationship throughout your entire code-base.
why would removing/adding listeners be complicated? If you have one
method that adds all the listeners and another that removes them,
these
can be called in setVisible() depending on the parameter. From my
point
of view this is easier than adding an event filtering mechanism.
It's probable I'm missing an important design/implementation issue
here, so please would someone explain :)