I am trying to make a date setter by JSpinner:
//got current date
` Date now = new Date();
//got"Date maxDate" from somewhere
SpinnerDateModel model = new SpinnerDateModel(now, now, maxDate, Calendar.DAY_OF_MONTH);
JSpinner spinner = new JSpinner(model);
JComponent editor = new JSpinner.DateEditor(spinner, "HH:mm dd/MM/yyyy");`
As you can see, date has boundries: from current date to some max date; and I want to make sure that that input (which invokes by Set button, see picture below):
spinner.getValue();
will be inside that zone. If user uses only arrow, it's ok: they don't allow to go beyond boundries.
But there is an issue: user can manually (without using arrows) set date:
Question: how can I forbid to make date change manually, and allow do it only by arrows?
(Bonus question: why can't I change date by arrows from the start (first I should change it manually, then it is available to make change by arrows).)
(sorry for bad english)