Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question about Window.hide()



hoverfrog wrote:

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 :)

If you want to use delegation instead of inheritance (required to override
setVisible or show/hide) you can install a ComponentListener on the Window
and do it as the component is shown/hidden.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.