I have taken a JPanel (say cardsPanel) and have set its layout as CardsLayout. After that I have added 3 cards on it (say card1, card2, and card3) all of JPanel type.
Now I want to get the topmost card of the cardsPanel whenever a user clicks on a button "Show".
So, How can I get the top-most card of the cardsPanel.