简体   繁体   English

获取当前显示的卡的参考

[英]Get Reference to Currently Displayed Card

Let's say I have a JPanel named cards and it has a layout type of CardLayout . 假设我有一个名为cardsJPanel ,它的布局类型为CardLayout Each card in the layout is also of class JPanel . 布局中的每个卡都属于JPanel类。 How do I get a reference to the JPanel that's currently being displayed in the layout? 如何获得对布局中当前显示的JPanel的引用?

Thanks. 谢谢。

How do I get a reference to the JPanel that's currently being displayed in the layout? 如何获得对布局中当前显示的JPanel的引用?

There is nothing in the API that allows you to do this, that I'm aware of. 我知道,API中没有任何可以执行此操作的操作。 So,I extended the CardLayout to provide this information. 因此,我扩展了CardLayout以提供此信息。

Check out Card Layout Focus for my implementation that allows you to get this information among other things. 请查看Card Layout Focus以了解我的实现,该实现使您可以获取这些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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