tags:

views:

22

answers:

1

Hello! I have the following problem .. I am using StackLayoutPanel and when I try to add a child of the same instance of another stack will not let me and I remove his head and child.

The question is how I can make my stack allows many children of the same instance?

I tried to make a wrapper of the children by putting them in another LayoutPanel, are all the heads, but it only added the last child ah the last head.

Thank you very much! Jero.

Widget stackLayoutPanel child header

+1  A: 

I don't know what a StackLayoutPanel is, however you should be able to add "different" instances of a component to the panel.

However, a Component can only have a single parent. So therefore you can't add the same Component to multiple panels.

This is solve by using "models". For example you can't add the same text field to two different panels but you can create two text fields and then share the model:

JTextField tf1 = new JTextField();
JTextField tf2 = new JTextField( tf1.getDocument() );
camickr