private Slider slider (final String name, float defaultValue) {
final Slider slider = new Slider(0, 1, 0.01f, false, skin);
slider.setValue(prefs.getFloat(name, defaultValue));
final Label label = new Label("", skin);
label.setAlignment(Align.right);
label.setText(Float.toString((int)(slider.getValue() * 100) / 100f));
slider.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
label.setText(Float.toString((int)(slider.getValue() * 100) / 100f));
if (!slider.isDragging()) {
prefs.putFloat(name, slider.getValue());
prefs.flush();
}
}