Seeking feedback on a possible JDatePicker Swing component
SWinxy
swinxythecat at gmail.com
Thu Aug 22 18:06:42 UTC 2024
Tejesh, I think it would be a nice feature, and I would be happy to help
with it. There are a lot of considerations for displaying calendars. I
don't think we should have the date & time combined into one UI component,
but separate components, the former of which I'll focus on here. There are
two parts to it: first is textbox(es), and second a calendar grid. Here are
some requirements that I can think of right now:
- Start of the week. Different regions of the world have the week start on
different days, usually Sunday or Monday, but some start on Saturday. [1]
macOS and Windows both let you change this to any day of the week. On
macOS, this is defined by NSCalendar's firstWeekday.
- Should there be one text field, or should there be three for
day-month-year? Allow the dev to choose? If multiple text boxes, the ways
to traverse to the next field should include the period, space, slash, and
dash keys in addition to the tab key. (This is because people can type
10/10/10 or 10.10.10 all at once and not have to press tab.) Pasting in a
date should be supported in either case, and converted to the displayed
locale.
- The UI should update in response to a notification from the system that
the user has changed their preferred calendar format.
- Either way we have the text box, allowing the developer to choose if they
want a text box with a popup calendar grid or one that is in the same panel
would be ideal. (That is, they add it to the same panel themself.)
- The calendar grid should be able to be oriented horizontally or
vertically. (When the calendar moves around, does it go left-right or
up-down?) Calendar grids often show the previous and next months' dates as
padding when the start and end of the month aren't cleanly cut by the start
and ends of the week. When going horizontally, the developer should have
the option to show or hide those dates. When vertical, the developer should
be able to decide if the grid is continuous or interrupted. (To pad with
numbers or to pad with empty space.)
- UI for changing the month and year of the grid. This can take the form of
left-right arrows, scrolling, and/or dropdown for the month and a text
field for the year.
Extra things:
- Calendar type. Most people use Gregorian, but a small number of people
can choose otherwise for their systems. macOS gives me a bunch of options,
but Windows only allows me to do Gregorian. This is a "wow wouldn't it be
cool" optional feature.
- A 'today' button, which selects the current date.
- How to represent a date range with a calendar and a textbox, I'm not
sure. The easy workaround would be to have the developer create two of
these date pickers. But a way to select a range would be welcome.
- If we do also have a component for time, should we allow for the changing
of timezones in the UI? Timezones are too much imo.
I'm relying on screenshots on Google for date pickers and NSDatePicker for
what features they have. I'm sure I would be able to make use of this
somewhere in my own Swing app.
SWinxy
[1] https://en.wikipedia.org/wiki/Week
On Thu, Aug 22, 2024 at 2:29 AM Tejesh R <tejesh.r at oracle.com> wrote:
> Hello Swing Community,
>
>
>
> Swing has a rich set of UI components in the core Java Platform.
> But it lacks a Date Picker which is a significant gap for many
> applications and so we are considering revisiting the idea of a Date Picker
> in core Swing.
>
> The function core of a DatePicker is to let a user select a day [and
> time?], or range of days [and time ? ],
> within optional application specified constraints.
>
> The JXDatePicker component was previously explored as part of the long
> defunct external SwingX project.
> This proposal does not imply reviving JXDatePicker, but being informed by
> it and date pickers for other platforms.
>
> Before even starting on this, we are seeking feedback from the community
>
> - Is it of interest ?
>
> - Would you use it ?
>
> - What features must it have ?
>
> - What features are nice to have ?
>
> - Do you have any experiences of other date pickers that reinforce those
> responses ?
>
> - Anything else ?
>
> If we move forward, we would propose a JEP and also expect that we would
> deliver it first as a preview feature [1] , so that it may evolve in
> response to feedback before becoming final.
>
> Please let us know your thoughts and suggestions on this proposal.
>
>
>
> Regards,
>
> Tejesh R.
>
> JDK client team
>
>
>
> [1] https://openjdk.org/jeps/12
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20240822/fb76ae37/attachment.htm>
More information about the client-libs-dev
mailing list