random technical thoughts from the Nominet technical team

Borland dbSwing date problems with JRE 1.6

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.5 out of 5)
Loading ... Loading ...
Posted by johnh on May 16th, 2007

We have found that dbSwing components (JdbTable, JdbTextField, JdbLabel etc) do not display dates when the application is run using JRE 1.6. The dates display correctly under JRE 1.5 and earlier.

The problem is caused by the method

protected String getDefaultPattern(int variantType)

in com.borland.dx.text.VariantFormatStr. In JRE 1.5 and earlier if no Formatter or Displaymask is set by the program, the function above loads a resource by

SystemResourceBundle.getLocaleElementsBundle(locale);

which gets the following Resourcebundle

sun.text.resources.LocaleElements

This bundle does not exist in 1.6 and an exception is thrown which is handled by setting the default Pattern to “”. These is the reason why nothing is displayed for date, time or timstamp columns.

To work round this we therefore need to set the displayMask for such columns e.g.

yourDateColumn.setDisplayMask("dd/MM/yyyy");

and dates are displayed correctly.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Recent Posts

Highest Rated

Categories

Archives

Meta: