Mailing Lists: Apple Mailing Lists

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

Showing dialogs (was "Re: Default button")



At 12:08 pm -0700 8/4/05, Glen Fisher <email@hidden> wrote:

The problem with show() and hide() isn't that visibility is a property, it's that they're less general than setVisible(), using two methods where one will suffice, and less consistent, since the "query" method (isVisible) isn't as obviously related to the "update" methods (show and hide). It would be perfectly reasonable to have, for example, enable() and disable() methods instead of setEnabled(). The logic that motivates adopting setVisible() in preference to show() and hide() applies just as much to windows as to any other component that can be shown and hidden.

Not really. There's more to it than just the convenience of having similar names. setVisible() and setEnabled() on components are on a par with each other, but show() on a top level window does much more. Consider validate() for example. Why isn't it setValid(true)? Perhaps just because you would never call setValid(false), but maybe also because it's more obvious that it does something than simply setting a property.


In any case, take a look at the definitions of isVisible() and isShowing(). For components visibility really just means "visibility enabled", it doesn't necessarily mean you can actually see the component yet. Visibility for a top level window is a different concept. By your reasoning, maybe the method on windows should be called setShowing(), to go with isShowing()? I think I prefer show().

How does "show()" make things any clearer than "setVisible(true)"? *Neither*
one says "doesn't return until the dialog closes". You *still* have to
remember that the call behaves differently when used with modal dialogs.

Because it's more suggestive of a definite action, just as naming a method kill() on a process would be more emphatic than setLiving(false) say.


-Rolf
--
Rolf Howarth, Square Box Systems Ltd, Stratford-upon-Avon UK.
_______________________________________________
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.