Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » CalendarCombo DateFormat Query(CalendarCombo DateFormat Query)
CalendarCombo DateFormat Query [message #694952] Sun, 10 July 2011 10:54
eclipsefan  is currently offline eclipsefan Friend
Messages: 11
Registered: June 2011
Junior Member
Hello Experts -

I have a requirement where in I need when a user picks a date in the calendar combo, it should be displayed as d-MMM-yyyy HH:mm (example: 21-Jul-2011 00:00) in the text control of the calendar combo widget.

I did the following while creating the calendarcombo instance -

CalendarCombo cc = new CalendarCombo(inner, SWT.NONE, new CustomSettings(), null);

where CustomSettings is defined as follows :

public class CustomSettings extends DefaultSettings {

public String getDateFormat()
{
return "d-MMM-yyyy";
}
}

Here is what I then do:

1. Pick a date. The system displays the date as 21-Jul-2011 00:00 in the text
control of the calendar combo widget.
2. Now I try to change the date by pulling up the widget. The system throws the
following error -

java.lang.NumberFormatException: For input string: "Jul"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at org.eclipse.nebula.widgets.calendarcombo.DateHelper.slashParse(DateHelper.java:561)
at org.eclipse.nebula.widgets.calendarcombo.DateHelper.parse(DateHelper.java:158)
at org.eclipse.nebula.widgets.calendarcombo.CalendarCombo.parseTextDate(CalendarCombo.java:859)
at org.eclipse.nebula.widgets.calendarcombo.CalendarCombo.showCalendar(CalendarCombo.java:1139)
at org.eclipse.nebula.widgets.calendarcombo.CalendarCombo$5.handleEvent(CalendarCombo.java:646)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at tablecombo.Tester.main(Tester.java:101)

Clearly, the code inside the calendar combo is facing problems with parsing the String "Jul". What am I missing in my code that can resolve this issue ? Please let me know.

Regards.



[Updated on: Sun, 10 July 2011 10:57]

Report message to a moderator

Previous Topic:RichText
Next Topic:Nebula grid loads slowly when there are more than 200 columns on Ubuntu Linux
Goto Forum:
  


Current Time: Thu Apr 25 05:54:26 GMT 2024

Powered by FUDForum. Page generated in 0.02504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top