CardLayout Question
Michael Kuhlmann
jdk at fiolino.de
Sun Apr 3 12:35:44 UTC 2022
Hi Sean,
the Javadoc clearly states:
| replaced by addLayoutComponent(Component, Object).
addLayoutComponent(String, Component) exists only in CardLayout, while
addLayoutComponent(Component, Object) is the generic method implemented
form LayoutManager2 interface. That's why it is preferred.
On 4/3/22 14:27, Sean Carrick wrote:
> Hey, All!
>
> I just have a quick question regarding the java.awt.CardLayout method
> addLayoutComponent(String name, Component component): Why is this method of
> adding a component deprecated? There is no setter for setting the name
> property, so I don't understand why this was deprecated by, at least, JDK11.
>
> I appreciate any information you can provide regarding this, as I use the
> CardLayout for creating wizards and like to keep my JPanels that contain
> each wizard step as separate classes so that the wizard classes do not grow
> exceptionally long. (Exponentially long based upon the number of steps in
> the wizard ) Since that version of the addLayoutComponent was deprecated,
> how then is one supposed to set the name of the card for showing them
> appropriately as the user moves through the wizard steps? Inquiring minds
> would like to know!
>
> Sincerely,
>
> Sean Carrick
> Owner - PekinSOFT Systems
> sean at pekinsoft.com
> (309) 989-0672
More information about the jdk-dev
mailing list