Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Setting the Nth Element of a Layout
VAADIN's AbstractLayout, the parent of Horizontal and VerticalLayouts, contains methods to add components to the back and in front of existing ones, but not in the middle of them. It should be pretty obvious how to perform this task, but it is not. Once a component is moved to another layout it is removed from the original, so an iteration will not work as the list of components changes in size in each iteration.
I have posted code for this at:
http://ramontalaverasuarez.blogspot.com.es/2016/04/vaadin-setting-nth-element-in-container.html
Is there a better way to achieve it?
Thank you.