Results 1 to 11 of 11
  1. #1
    amiableguy is offline Member
    Join Date
    Jul 2016
    Posts
    4
    Rep Power
    0

    Default Feedback wanted: A better time chooser widget

    Dear Swing programmers,
    I've created a new Swing widget for selecting 24-hour times, as seen in the animated gif below.
    I believe it's an improvement over the cumbersome scrollbar-style time pickers used in Google calendar.
    I'd like to hear what you think of it.
    Visit the web page to play with the widget (if you have the
    Java plugin enabled in your browser) or watch a 1 minute tutorial video.
    Is it obvious how to use it? Can you select a desired time easily?
    Did you have questions about how to use it? Do you have ideas for improvement?
    Please reply to this post. Thanks in advance for your consideration.

    Feedback wanted: A better time chooser widget-8secdemo.gif

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Feedback wanted: A better time chooser widget

    Nice widget. How the the styling go? Does it follow the current LookAndFeel?

    It's rather similar to Thunderbird's selector for their calendar:
    Feedback wanted: A better time chooser widget-thunderbird.png
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,967
    Rep Power
    32

    Default Re: Feedback wanted: A better time chooser widget

    What about showing a 24 hour time: 00:00 to 23:59?
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    amiableguy is offline Member
    Join Date
    Jul 2016
    Posts
    4
    Rep Power
    0

    Default Re: Feedback wanted: A better time chooser widget

    Yes, it uses the system look and feel.

  5. #5
    amiableguy is offline Member
    Join Date
    Jul 2016
    Posts
    4
    Rep Power
    0

    Default Re: Feedback wanted: A better time chooser widget

    Quote Originally Posted by Norm View Post
    What about showing a 24 hour time: 00:00 to 23:59?
    Currently it does not show military time. I chose AM/PM as that is what most civilians are used to.
    However, the values displayed are simply constants in the source code and easy for
    a developer to modify.

    I agree it might be a nice feature to allow the user to choose which mode they would like displayed,
    but I haven't invented a convenient way to include that in the UI design. It seems like adding a
    checkbox or radio button to allow the user to choose the display mode would add some annoying
    clutter to the display. I would be happy to consider any ideas you might offer.
    Thanks,
    --john

  6. #6
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Feedback wanted: A better time chooser widget

    Quote Originally Posted by amiableguy View Post
    Currently it does not show military time. I chose AM/PM as that is what most civilians are used to.
    That is, "civilians" in the US only. Think big. The US and the UK are the two countries using the 12 hour system predominantly (UK is even mixed). Probably the rest of the world uses the 24 hour system. Just like "we" (read: Non-US-civilians) use dd-mm-yyyy instead of mm-dd-yyyy.

    I've tried to see if you can detect it via Locale, DateTimeFormat, LocalTime etc, but it's not as trivial as it sounds. My opinion is that it should be switchable, if it's not dependent on Locale.getDefault(). I haven't taken the time to think about what the UI should look like.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  7. #7
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Feedback wanted: A better time chooser widget

    Update: I had a stab at it and I have three things:

    1) You can make the AM/PM boxes clickable to make them switch to 24 hours and back. Besides that, you can add a TimeSelectionField.set24HourMode(true|false) or TimeSelectionField.setHourMode( TimeSelectionField.HOUR_24 | TimeSelectionField.AM_PM)
    2) There is no way to detect if the user cancelled (by hitting escape or clicking outside the box). I would expect the time in actionPerformed to be null, or the actionPerformed shouldn't not fired at all.
    3) There is no way to set the time to display initially. Maybe it sould take a constructor parameter or a method setTime(LocalTime t) and/or setTime(Date d)

    Keep up the good work!
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  8. #8
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Feedback wanted: A better time chooser widget

    Update 2:

    Thinking about it, it would be great to have TimeSelectionField return an actual time (which would be non-trivial though), but at least it should return the individual values (getHour(), getMInutes()). You return a String but it is heavily localized to the US. I think 99% of the times, the developer will need to work with the actual time, so instead of returning the whole (US-based) String, at least give them the option to get all the individual parts, so I can feed that into LocalTime.of( hours, minutes,second).
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  9. #9
    amiableguy is offline Member
    Join Date
    Jul 2016
    Posts
    4
    Rep Power
    0

    Default Re: Feedback wanted: A better time chooser widget

    Quote Originally Posted by SurfMan View Post
    Update: I had a stab at it and I have three things:
    These are great suggestions, SurfMan, I'll get to work on them right away.

    it would be great to have TimeSelectionField return an actual time
    There is this method:
    Java Code:
    getSelectedTime()
    that returns the user's selection as a java.util.Date, is that what you were looking for?

  10. #10
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Feedback wanted: A better time chooser widget

    Quote Originally Posted by amiableguy View Post
    These are great suggestions, SurfMan, I'll get to work on them right away.


    There is this method:
    Java Code:
    getSelectedTime()
    that returns the user's selection as a java.util.Date, is that what you were looking for?
    Hmm, I must have missed that method. That will probably do just fine. I'll check tomorrow :)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  11. #11
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Feedback wanted: A better time chooser widget

    A visual glitch:
    1) Click the arrow down
    2) Let the popup show
    3) Click the arrow down again

    Feedback wanted: A better time chooser widget-time.png
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Unpaid part-time developer wanted
    By draithwilliam in forum Jobs Offered
    Replies: 10
    Last Post: 04-24-2012, 01:35 PM
  2. Replies: 3
    Last Post: 08-23-2011, 12:46 PM
  3. Using File Chooser
    By shaungoater in forum New To Java
    Replies: 0
    Last Post: 03-20-2008, 12:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •