monthSpinner.setSpinnerData(new NumericSpinnerData(0, 11));
monthSpinner.setItemRenderer(new MonthSpinnerItemRenderer());
monthSpinner.setCircular(true);
monthSpinner.getStyles().put("sizeToContent", true);
monthSpinner.getSpinnerSelectionListeners().add(new SpinnerSelectionListener() {
@Override
public void selectedIndexChanged(Spinner spinner, int previousSelectedIndex) {
Calendar calendar = (Calendar)getComponent();
calendar.setMonth((Integer)spinner.getSelectedItem());
}
});
// Year spinner
yearSpinner = new Spinner();
yearSpinner.setSpinnerData(new NumericSpinnerData(0, Short.MAX_VALUE));
yearSpinner.getSpinnerSelectionListeners().add(new SpinnerSelectionListener() {
@Override
public void selectedIndexChanged(Spinner spinner, int previousSelectedIndex) {
Calendar calendar = (Calendar)getComponent();
calendar.setYear((Integer)spinner.getSelectedItem());
}