This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does SWT provide a Calendar Widget?

 
Sunil Aggarwal
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can get a Calendar(or datepicker) widget here ---> SourceForget.net SWT DatePicker
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Atul Shrivastava
Greenhorn
Posts: 19
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic