Building any layout with AbsoluteLayout
If the basic layouts offered by Vaadin limit us, and we want to create some other special crazy layout, we can use AbsoluteLayout
. There are no limits in this layout. We can insert components into any place we want. In this recipe, we will create a demo of a custom layout, Circle layout. There are also some reasons not to use AbsoluteLayout
. They are described in the There's more... section at the end of this recipe.
How to do it...
Carry out the following steps to create a custom layout using the AbsoluteLayout
class:
We create a project with the main UI class called
Demo
.public class Demo extends UI {…}
We will create a class called
CircleLayoutDemo
that extendsAbsoluteLayout
.public class CircleLayoutDemo extends AbsoluteLayout {...}
Let's use icons from the
Runo
theme. So we create an array of icon names.private String[] icons = { "cancel.png", "calendar.png", "document.png", "email.png", "globe.png", "help.png", "note.png", "ok.png", "trash...