How can I get the string identifier of the selected panel in card layout.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
The CardLayout does not allow you to do this. However, you should be able to access the top panel of the CardLayout.
So a little work around is to give each added panel a name, equal to the string identifier. That way you can get the top card, and get it's name. This is how you do it:
The CardLayout does not know what the currently selected panel is. You should keep this in memory yourself, when calling the show() method.