Dicussions and feedback on the JSpinner Article
> One useful trick with Spinners is to only process
> events after there have been no events for a few
> seconds. The reason for this is otherwise every click
> on the Spinner creates event handling. For example if
> you step through every second in a spinner
> representing seconds in a minute then you get an
> awful lot of event processing. I only process Spinner
> events when none have been generated for six seconds
> - which means the user has taken his or her paw off
> the keyboard...
Doesn't that violate some cardinal rule of usability? Like things should respond to clicks witing 200ms?
It's bad enough you subject the poor user to the tiny spinner buttons that complicate the simple task of entering a number on a keyboard, but then you ignore their clicks as well?
I think some developers are forgetting why Cardinal Rules exist ;) (adapted from your view in the other thread)..
I said delay the EVENT PROCESSING - you don't want to update a database 60 times for one change in the Datetime (because someone has clicked through the entire circle because they feel like it) ... Hence wait until they are done... If they do something like lose focus or change screen the update is instant...
Hope that is clearer...
Ah, I get it, and nice point regarding cardinal rules :)
That said, perhaps instead of delyaing event processing you shouldn't be using a spinner? I mean, I think the spinner is a debatable control anyway (don't most users want to avoid the mouse and use the keyboard?), but it seems like in your case, you either wouldn't want to use it, or you want to update the DB on an action event (e.g. button press) instead....
> perhaps instead of delyaing event
> processing you shouldn't be using a spinner? I mean,
> I think the spinner is a debatable control anyway
> (don't most users want to avoid the mouse and use the
But that is exacly why you want to use a spinner; it provides both at the same time.
The user can choose which she likes best.
Hi, I am happy to find many specialists here. I hope I could find some clues about my problem.
I have begun to use JSpinner recently. We support our product on both Windows and Mac OS. But it looks like that JSpinner with SpinnerDateModel and DateEditor does not work well when I try to set CalendarField with any mouse actions or key actions and then use up and down buttons to change the field.
Example: SpinnerDemo example provided along with "How to use ... " article
When using "Another Date" spinner, I can select the field (either month or year) I want to change by clicking the field with my mouse. In Windows, caret will then stay in this field, and when I click up or down button, the field will increment or decrement. However, under Mac, no matter which field I choose, the buttons can only change month field.
This problem also happens when using other kind of date format.
Any suggestions and helps are highly appreciated.
One useful trick with Spinners is to only process events after there have been no events for a few seconds. The reason for this is otherwise every click on the Spinner creates event handling. For example if you step through every second in a spinner representing seconds in a minute then you get an awful lot of event processing. I only process Spinner events when none have been generated for six seconds - which means the user has taken his or her paw off the keyboard...
Qt does this even smarter; first they disable the pointer when the user starts to type and second when that pointer leaves the 'spinner' then the value is committed.
The latter is also done in the Spinner from the UICompiler open source project. Unfortunately this still generates too many events since I get a 'mouseleave' event when entering and when leaving, its these little bugs that make Swing always surprising to work with :)
Note that the spinner has several serious bugs that limit its usablity in at least 1.4.2
bug 38, 39, 40 and 41
Beside these the obvious omissions are things like a 'getValue()' - like method that returns an int without casting to an Integer, as well as supporting mousewheel action.
All of these are 'fixed' in UIC-themes and extending-classes. I just hope they will be standard in the next Java Release.
See for yourself at: http://uic.sourceforge.net/tutorials/configdiag.jnlp click on the color-button to get a color-config-dialog.
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.