Does anyone know how to work with the Card Layout in the NetBeans GUI builder tool? I want to show panels as per the JRadioButton
selection, so I want to lay this out using the 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
Here is a very simple tutorial that might start you off in the right direction. I hope it is helpful.
The Sun tutorial seems a good place to start to learn about Card Layouts.
Concerning NetBeans per se, simply assign the card layout to the component you wish to assign to (example a JPanel), give it a name, and then for the JPanel child components (other JPanels for example), specify their
cardName
property. To switch from one to another, you code it in an event.card.next(yourPanel);
will loop through all the components in yourmainpanel
then come to first one. To show a component with your own desire try following (think if there are 5 components and you are on the 2 and want to show first then you have to go through rest of all in the Vincent Ramdhanie's example, JRL's answer is good according to that gives a quick jump to one you want, but here is another way.This way is used when you have a tree and show a panel or component on a tree selection. It shows directly that component. On the tree add a
value change listener
and get the selection item and show appropriate panel.