Greg Valvo
Greg Valvo

Reputation: 1099

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 classJPanel. How do I get a reference to the JPanel that’s currently being displayed in the layout?

Thanks.

Upvotes: 0

Views: 25

Answers (1)

camickr
camickr

Reputation: 324128

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.

Upvotes: 2

Related Questions