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

Restricting buttons in Rich text area


Vaadin provides a very useful component called RichTextArea. In this area, we can edit formatted text. The content is represented in HTML and it consists of two toolbars. Sometimes users don't need all the functions, for example in a simple web chat. Only basic functions such as bold, italic, and underline are sufficient. In those cases, it's better to use fewer buttons than those set by default. The editor then becomes clearer and easier for users. Sometimes less is more. In this example, we will learn how to do it.

This is the Rich text area with default buttons:

This is our target. We have restricted the number of buttons.

How to do it...

Carry out the following steps to restrict the number of buttons in the Rich text area component:

  1. We create a Vaadin project with the main UI class named Demo as follows:

    public class Demo extends UI {…}
  2. In the init method, we create an instance of the RichTextArea class and we set it as the content of our application...