aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Does SWT provide a Calendar Widget? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Does SWT provide a Calendar Widget?" Watch "Does SWT provide a Calendar Widget?" New topic
Author

Does SWT provide a Calendar Widget?

Sunil Aggarwal
Greenhorn

Joined: Aug 26, 2004
Posts: 14
Hi All,

I require a Calendar widget, which I assume is not available as part of the SWT toolkit.

Also, does SWT class library have an equivalent for a Spinner widget in Swing?

There are Calendar and spinner custom widgets in SWT available on the net but they have certaim license issues...

Regards,
Neha
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

There is no Spinner or Calendar controls for SWT. There is an article on writing your own SWT widgets on eclipse.org. I believe there is even an example on how to create your own Spinner control. I would search on eclipse.org for this article and go from there.
Mike Evans
Greenhorn

Joined: Jul 16, 2002
Posts: 8
The following article demonstrates how to wrap a native spinner control, at least in Windows and Motif.

http://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm

HTH

Mike E.
John Kouch
Greenhorn

Joined: Dec 10, 2002
Posts: 4
You can get a Calendar(or datepicker) widget here ---> SourceForget.net SWT DatePicker
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I also ran across this in case you want something very specific to your needs. I wonder why JFace doesn't have a component yet. However, technically, core Swing doesn't have one yet either which is pretty pathetic.


GenRocket - Experts at Building Test Data
Atul Shrivastava
Greenhorn

Joined: Jan 12, 2009
Posts: 19

You can use DateTime widget for this:

Usage examples:

1. Monthview calendar, which is always open - DateTime calender = new DateTime(form.getBody(), SWT.CALENDAR);

2. Date only, collapsed - DateTime date = new DateTime(form.getBody(), SWT.DATE);

3. Time only, collapsed - DateTime time = new DateTime(form.getBody(), SWT.TIME);

4. Date and Time, with dropDown - DateTime dateDropDown = new DateTime(form.getBody(), SWT.DATE | SWT.DROP_DOWN);


OCP (SCJP) - Java 1.6
 
 
subject: Does SWT provide a Calendar Widget?