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:
We create a Vaadin project with the main UI class named
Demo
as follows:public class Demo extends UI {…}
In the
init
method, we create an instance of theRichTextArea
class and we set it as the content of our application...