Migrating show/hide code to setVisible

Philip Race philip.race at oracle.com
Fri Jul 29 16:45:13 UTC 2022


I'm not sure it would necessarily break things but it is churn (today 
setVisible(boolean) actually calls show(boolean)! )
that doesn't help anything that I can see. We'd still have show() and 
hide() .. so what would it solve ?

FWIW I never really liked that show() and hide() were deprecated.
There nothing wrong with them, but folks were being encouraged
to adopt the Java Beans component model practices so were directed to 
setFoo() and getFoo()

I'd almost consider UN-deprecating them .. but it isn't a priority ..
.. and JavaFX uses show() and hide()

https://openjfx.io/javadoc/17/javafx.graphics/javafx/stage/Window.html#show()

-phil.



On 7/29/22 8:15 AM, Andy Goryachev wrote:
>
> I am afraid that this change will instantly break >80% of all deployed 
> applications.  Same for setSize()/resize().
>
> -andy
>
> *From: *client-libs-dev <client-libs-dev-retn at openjdk.org> on behalf 
> of SWinxy <swinxythecat at gmail.com>
> *Date: *Thursday, 2022/07/28 at 23:25
> *To: *client-libs-dev at openjdk.org <client-libs-dev at openjdk.org>
> *Subject: *Migrating show/hide code to setVisible
>
> The show() and hide() methods of java.awt.Component have been 
> deprecated for a long time now (JDK 1.1, 25 years ago), and a 
> substantial bit of code is duplicated between them—rather 
> unnecessarily. I think that their code should be merged into the 
> preferred setVisible(boolean) method. The deprecated show(), hide(), 
> and show(boolean) would call setVisible(boolean) with the 
> corresponding value. They won't be deprecated for removal.
>
> From what I can tell, a migration can be done pretty easily. The 
> headache I imagine can result is with mixing inheritances/overrides. 
> Thoughts?
>
> -SWinxy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20220729/4019f33c/attachment.htm>


More information about the client-libs-dev mailing list