The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » SwingLabs

Thread: How to select dates than span months?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Last Post: Nov 14, 2008 4:35 AM by: osbald
cowwoc

Posts: 1,055
How to select dates than span months?
Posted: Nov 13, 2008 3:01 PM
 
  Click to reply to this thread Reply

I tried using JXMonthView but it only lets me select a range of dates within a single month.

The closest I've seen to the behavior I'm looking for is Windows Vista's Calendar application. Clicking the mouse button and dragging to the bottom right automatically scrolls to the next month(s). Dragging to the top left scrolls to the previous months.

There is also Google Analytics that lets you pick the start date and end date without dragging but does so without opening and closing new calendars every time.

What is the acceptable behavior in this case? Do you simply use two JXDatePickers?

Thank you,
Gili

Message was edited by: cowwoc

osbald

Posts: 853
Re: How to select dates than span months?
Posted: Nov 14, 2008 4:34 AM   in response to: cowwoc
 
  Click to reply to this thread Reply

Certainly I've used two JXDatePickers for ranges before. I've also added a combo for common preselected ranges and a quick-pick button that'll show a JXMonthView to select both dates (custom choice) via selection. http://picasaweb.google.co.uk/osbald/DateRangePicker

You may get some mileage from using a custom JXMonthView popup and making it larger than one month. JXMonthView will show as many months as it has space for. With several months you can span your selection across months (given relatively short ranges < x months). Try the swingx demo on swinglabs.org to play with JXMonthView.

Negatives here are I'm not convinced the navigation controls, at the top of each month work so well in this mode and it's shame you can't specify where the current month should appear (as in start, middle or end for picking a future date, recent range or a near past date).

JXDatePicker should only be used for a picking single date.




 XML java.net RSS