Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » CalendarCombo java.lang.NumberFormatException(catching java.lang.NumberFormatException in CalendarCombo )
CalendarCombo java.lang.NumberFormatException [message #526913] Tue, 13 April 2010 13:36
nir dweck is currently offline nir dweckFriend
Messages: 17
Registered: April 2010
Junior Member
Hi,
I am using the CalendarCombo. If I write letters instead of the enteir date, I can catch the exception in the DateParseExceptionListener. However if I leave the date as it is and just add a few letters at the end (e.g. 04/13/2010ede), I get a NumberFormatException in the stderr and I am not able to catch the exception. I did a workaround and added a FocusListener that whenever the combo looses the focus, it does m_validTill.setDate(m_validTill.getDate());, which hides the error from the user, but I still get the exception in the stderr. Is there any way to catch the exception?
Thanks,
Nir.

Here is my code:
m_validTill = new CalendarCombo(cAutoOrderQnt, SWT.NONE, false);
m_validTill.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, false, 1, 1));
m_validTill.setDate(SysCfg.Todday);
m_validTill.setDisallowBeforeDate(SysCfg.Todday);
m_validTill.addFocusListener(new FocusListener() {

@Override
public void focusLost(FocusEvent e) {
//in order to remove any user error like 13/04/2010ddd which for some reason doesn't throw a DateParseException, but sends an exception to the stderr
m_validTill.setDate(m_validTill.getDate());

}

@Override
public void focusGained(FocusEvent e) {
//do nothing
}
});
m_validTill.addDateParseExceptionListener(new IDateParseExceptionListener() {

@Override
public void parseExceptionThrown(CalendarDateParseException dateParseException) {
m_validTill.setDate(SysCfg.Todday);
m_validTill.setDisallowBeforeDate(SysCfg.Todday);
}
});
Previous Topic:Checkbox in Grid column header
Next Topic:CalendarCombo java.lang.NumberFormatException
Goto Forum:
  


Current Time: Fri Apr 26 02:36:16 GMT 2024

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

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

Back to the top