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



Gary Ford wrote:

>I believe I don't understand the Window.hide() method.

I believe you've found a bug.  I confirmed it on my machine.  I see the
same behavior you described.

The problem occurs under the 1.4.2 and 1.5 I tested.  I did not try it
under the latest Preview of 1.5R4.

I also tried it under 1.4.2 on a W2K box, and did NOT see the problem,
which further confirms my belief this is a bug, rather than an obscure
feature.


>I have both
>JFrames and JDialogs that I hide() rather than dispose(), because I will
>need them frequently.

A window can be reshown after a dispose().  Or at least it should be.  I
vaguely recall a past bug where this didn't work, but it was a while ago.

I think you may be overreacting to the documentation differences for hide()
vs. dispose().  Do you have to run the app on exceptionally puny machines,
where rebuilding the peers is quite noticeable?  Have you tested the actual
speed difference between hide()/show() vs. dispose()/show()?


>Is this the expected behavior of Java? Do I need to remove and reinstall
>mouse listeners in all the components in hidden windows?

No, I don't think it's the expected behavior.

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.

  -- GG


 _______________________________________________
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.