Hello,
I have to get euro prices in a dialog.
My solution would be a text field initially filled only with an euro
sign (undeleble) that
accept only digits, an optional comma and optional 1 or 2 digits for
cents.
Even if the field is left blank, I want to check all data (there are
also other components)
when the user push an OK button.
How can I do this? I am a bit confusing with JFormattedTextFields,
JTextFields,
NumberFormat and DecimalFormat classes.
Thanks,
Gaetano
Oliver Wong - 13 Mar 2006 21:47 GMT
> Hello,
> I have to get euro prices in a dialog.
[quoted text clipped - 9 lines]
> NumberFormat and DecimalFormat classes.
> Thanks,
See
http://java.sun.com/docs/books/tutorial/uiswing/components/formattedtextfield.html
They cover this problem, except they use the $ character rather than the
euro symbol, and the $ character is deletable, but automatically gets
reinserted when the text field loses focus.
- Oliver