This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 185212 - Allow to specify valueClass property of JFormattedTextField's formatter
Summary: Allow to specify valueClass property of JFormattedTextField's formatter
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: issues@guibuilder
Keywords: PLAN
Depends on:
Reported: 2010-04-28 21:07 UTC by babicka_baba
Modified: 2013-09-04 13:46 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description babicka_baba 2010-04-28 21:07:44 UTC
The standard customizer for JFormattedTextField's property FormatterFactory does not support formatting, that is consistent with BigDecimal - using standard format for number leads to ClassCastException, when the value property of the JFormattedTextField is bound to a BigDecimal property.
The issue is also described with a partial workaround at

Although I can add my own support for BigDecimal it's an annoyance... Meanwhile I suggest everyone who needs it to read the following articles... It worked for me, but not without some minor trouble...
Comment 1 Jan Stola 2010-04-29 09:22:46 UTC
I am sorry, I am not sure that I understand what you request. Could you, please, elaborate on that?

I can see one problem in our support that relates to BigDecimal values in JFormattedTextField. When you specify formatterFactory using our customizer and set BigDecimal value to your formattedTextField then getValue() method returns numbers of type Double (when the text of the textField is modified).

This can be fixed by setting valueClass property of the corresponding formatter. For example:


Is that what you are asking for? In other words, do you ask for the possibility to specify valueClass in the customizer of formatterFactory property?
Comment 2 babicka_baba 2010-05-03 13:40:12 UTC
Yes, adding valueClass to the customizer would be one solution.
My first idea was to add a only a bigdecimal preset - either as a special category distinct from "number", or to add a "Big decimal default" under the "integer default" in the formats in "number" category.