Swap childrens widget

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Swap childrens widget

abdielcs
Hi, I added two org.netbeans.api.visual.widget.Widget to one parent with a simple addChild(), now I try to swap it's positions.
Trying with
Code:
Collections.swap(parent.getChildren(), index, index-1)

 get
Code:
java.lang.UnsupportedOperationException
        at java.util.Collections$UnmodifiableList.set(Collections.java:1311)



So, seems that the list is unmodifiable. Also try with
Code:
parent.addChild(0, childWidget)

 for change the childs index and get
Code:
java.lang.AssertionError

. So, how the childs widgets can be reordered?