简体   繁体   中英

Get Reference to Currently Displayed Card

Let's say I have a JPanel named cards and it has a layout type of CardLayout . Each card in the layout is also of class JPanel . How do I get a reference to the JPanel that's currently being displayed in the layout?

Thanks.

How do I get a reference to the JPanel that's currently being displayed in the layout?

There is nothing in the API that allows you to do this, that I'm aware of. So,I extended the CardLayout to provide this information.

Check out Card Layout Focus for my implementation that allows you to get this information among other things.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM