TL; DR
Much easier in Vaadin 8.
radios.setItems( Boolean.TRUE , Boolean.FALSE );
... and ...
radios.setItemCaptionGenerator( ( ItemCaptionGenerator < Boolean > ) item -> { return item ? "Active" : "Inactive";
Vaadin 8
Vaadin 8 is much simpler and more intuitive!
Vaadin 8 offers a new simplified data model , using modern Java features to eliminate the Container interface that completes your content in the old data model .
Java Generics support means the radio button widget knows the type of your content elements. In this question, this type is a Boolean class.
RadioButtonGroup < Boolean > radios = new RadioButtonGroup <>( "T/F:" );
transmit objects to be represented by radio buttons
Now we just throw our objects into the widget, for example RadioButtonGroup . In the case of this question, we throw a couple of Boolean objects, the predefined constants Boolean.TRUE and Boolean.FALSE . Reorder the arguments to change the order of the switches presented to the user.
radios.setItems( Boolean.TRUE , Boolean.FALSE );
To pre-select one of the switches, simply refer to the desired object of the object. Here it will be either a constant, or Boolean.TRUE or Boolean.FALSE .
radios.setValue( Boolean.FALSE );
As for the shortcuts that we present to the user for each switch, by default each object of the object has its own toString method. For us, this means that true and false will be the text used for the radio button labels.

Tagging
Our question here requires alternative labeling of our switches, for example localization . Therefore, we call setItemCaptionGenerator and pass the small generator we write to create a string for each switch.
Our generator uses a ternary operator convenient for a conditional based on a Boolean value. Remember that in the following code, a item is a Boolean object.
radios.setItemCaptionGenerator( new ItemCaptionGenerator < Boolean >( ) { @Override public String apply ( Boolean item ) { return item ? "vrai" : "faux"; // French for "true"/"false". } } );
Or use lambda syntax.
radios.setItemCaptionGenerator( ( ItemCaptionGenerator < Boolean > ) item -> { return item ? "vrai" : "faux"; // French for "true"/"false". } );
Here is a screenshot of the same Boolean objects that show tags in French.

In particular, it is requested in the question "Active" and "Inactive".
radios.setItemCaptionGenerator( ( ItemCaptionGenerator < Boolean > ) item -> { return item ? "Active" : "Inactive";
Response to user request
You may want to answer when the user wants to press the switch. Add a value change listener. Pay attention to how we are informed about the object located behind the element selected by the user, and not the text of the label we created. Calling event.getValue( ) returns a Boolean type without the need for casting due to Java Generics. Here, the code knows that the radio buttons represent Boolean objects, not just text.
radios.addValueChangeListener( new HasValue.ValueChangeListener < Boolean >( ) { @Override public void valueChange ( HasValue.ValueChangeEvent < Boolean > event ) { Notification.show( "User chose: " + event.getValue( ) , Notification.Type.TRAY_NOTIFICATION ); } } );
Or use lambda syntax.
radios.addValueChangeListener( ( HasValue.ValueChangeListener < Boolean > ) event -> Notification.show( "User chose: " + event.getValue( ) , Notification.Type.TRAY_NOTIFICATION ) );

Whole example
Here is a complete working example in a single class file.
package com.example.vaadin.radio; import javax.servlet.annotation.WebServlet; import com.vaadin.annotations.Theme; import com.vaadin.annotations.VaadinServletConfiguration; import com.vaadin.data.HasValue; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; import com.vaadin.ui.*; @Theme ( "mytheme" ) public class MyUI extends UI { @Override protected void init ( VaadinRequest vaadinRequest ) { final VerticalLayout layout = new VerticalLayout( ); RadioButtonGroup < Boolean > radios = new RadioButtonGroup <>( "T/F:" ); radios.setItems( Boolean.TRUE , Boolean.FALSE ); radios.setValue( Boolean.FALSE ); radios.setItemCaptionGenerator( ( ItemCaptionGenerator < Boolean > ) item -> { return item ? "vrai" : "faux";
More details
See the manual for the radio button .
In Sampler < > / a>.
See What's New at Vaadin .