the corner office

a blog, by Colin Pretorius

SWT DateTime

Eclipse 3.3 has a new feature, a DateTime component, which means you don't need to rely on third-party widgets anymore. I'm quite pleased because I never made the effort to actually understand or use one of the custom widgets normally pointed to in forums and the like, and now I don't need to.

At present it has two shortcomings I dislike: first, it can't act like a drop-down, a-la your average web page, or for that matter, the good old Notes date control. You can either have a date spinner, or a time spinner, or a full date selector, but that's all. I guess you could build a composite that mimics drop-down functionality with a custom dialog, but it'd be better if it was built in.

The second thing I'm not nuts about, is that you can't just give it (or retrieve) a date value: you have to explicitly set or get each component of the date or time. How hard could it be to have a setDate(java.util.Date) method, or, if political API correctness is an issue, a setDate(java.util.GregorianCalender) method?

Nonetheless, a nice addition.

{2007.07.11 23:13}

« Europa

» Lulz