Hi to All! I have a POS Software which I have developed in Java, NetBeans IDE. I am deploying this software on a variety of Windows Computers / Laptops for 5 years. I have used JFormattedTextFields for double data type in the whole Software. And I have set Format of this field to two decimal places. For example if an user types 12.325 , then this field returns 12.32 , Taking another example if an user types 12 , then this field returns 12.00 This is the perfect functionality that I want and my Software is working fine on all the clients Desktops/Laptops.

But a weird problem occurred yesterday, when I gave demo to a new Italy Based Client. For example If I type/enter 12.35 in the JFormatedTextField it automatically replaces decimals with comma i-e it returns 12,35 Taking another example if You will type 5 , it is returning 5,00 automatically. And this is bug, I can't figure out why is this happening. First time I have faced this error. It is the same Software, same code and same Java Version. Kindly guide me about the problem

Note1- This error is occurring in case of JFormatedTextField only.
Note2- The Clients computer has Windows 10 Pro (But I think this is not the cause of error, because I have deployed my software on hundreds of clients on Window 7,8,10)

*Note3- My Client is Italian that's why he has set Italian Language on his Laptop From Windows Settings, that's why all System icons and Text appears in Italian on his laptop. But 3rd party software appear in same language in which that software intend to. My software's Language is English and all the labels and buttons appears in English in my Software and this is perfectly fine.
Only the problem is with JFormatedTextField as I mentioned above.
So I am thing about may be there is such a system setting which is cause of this change/Error on his Laptop.
Waiting for your guidance. Thanks in advance.

Actually this is how it should work on Italian systems.

Use a comma instead of a decimal point to show decimals in Italian.

0,5 (zero virgola cinque) 0.5 (nought point five)
3,4 (tre virgola quattro) 3.4 (three point four)

My view is this is not broken. But there is more to read about this with https://www.google.com/search?&q=force+decimal+point+in+italian+window

Some countries including France where I live use a . between thousands and a , before the decimals. Java localisation will automatically default to display numbers in the correct format for the users locale.
You can override this by setting an explicit locale in your program if you want to use the same formatting regardless of local norms.

https://docs.oracle.com/javase/6/docs/api/java/util/Locale.html#setDefault(java.util.Locale)

In this case, I would recommend you to use various handy helpers, perhaps on the Internet you can find information that will help you to solve this problem. I just often do it myself.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.