Book Image

Vaadin 7 Cookbook

Book Image

Vaadin 7 Cookbook

Overview of this book

Table of Contents (19 chapters)
Vaadin 7 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. We create a project with the main UI class called Demo.

    public class Demo extends UI {…}
  2. We will create a class called CircleLayoutDemo that extends AbsoluteLayout.

    public class CircleLayoutDemo extends AbsoluteLayout {...}
  3. 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...