<Swing Dev> How to add start and end time values
Pavel Porvatov
pavel.porvatov at oracle.com
Tue Jan 24 11:34:21 UTC 2012
Hi Sanjaya,
You should use something like this:
SpinnerDateModel model = new SpinnerDateModel(new
Date(), null, null, Calendar.HOUR_OF_DAY);
JSpinner spinner = new JSpinner(model);
JSpinner.DateEditor editor = new
JSpinner.DateEditor(spinner, "hh:mm");
spinner.setEditor(editor);
To set range you can use SpinnerDateModel#setStart/setEnd methods.
Regards, Pavel
> Hi all,
> I want to keep two spinners in my UI which displays only the
> time.(example 13:30) not the time with date.I also want to make the
> 1st spinner available for selecting any time value between 00:00 to
> 23:59.But I want to restrict the spinner 2 in such a way that only
> time values after the selected value of first time spinner will be
> allowed to select.
> As example if I select 14:00 in spinner1 then I want to select the
> time of spinner2 which is after 14:00 before 23:59.How can I restrict
> spinner2.What kind of spinner should I use?
> Any help please
> Thank you
> Sanjaya
More information about the swing-dev
mailing list