O'Reilly logo

Vaadin 7 UI Design By Example Beginner's Guide by Alejandro Duarte

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sliders

A Slider is a component that allows the user to drag an indicator to select a value within a configurable range. The following code will create a slider to select a value between 0 and 100:

Slider slider = new Slider("Drag the point");
slider.setMin(0.0);
slider.setMax(100.0);

We can set a value programmatically using the setValue method:

slider.setValue(30.0);

Note

If an out of the range value is set a ValueOutOfBoundsException is thrown.

This is how sliders look like:

Sliders

Like many other input components, we can listen to value changes:

slider.addValueChangeListener(new ValueChangeListener() {
  public void valueChange(ValueChangeEvent event) { Notification.show("Attention! ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required