-
Book Overview & Buying
-
Table Of Contents
Vaadin 7 Cookbook
By :
Some users want to use the mouse as little as possible. They prefer to use the keyboard. For these users, we can improve our application by adding keyboard shortcuts. In this recipe, we will show how to add shortcuts on components in Vaadin's application. We will add two actions. The first action is for saving and the second action is for showing the window with Help.

Carry out the following steps to create custom shortcuts:
Create a Vaadin project with a main UI class named Demo as follows:
public class Demo extends UI {…}We create a class called ShortcutPanel which extends the Panel class and implements the Handler interface. We extend the Panel class because the keyboard actions can currently be attached only to Panel and Window.
public class ShortcutPanel extends Panel implements Handler {…}At the beginning of the class, we create two objects. The first one is a window for showing Help. This instance is created by a separate method. The second object...
Change the font size
Change margin width
Change background colour