Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove comma from TextField in Java

Tags:

java

swing

I have a JFormattedTextField with the Name Hectare. The double type value is declared as shown below

         String cultivationSize = JFormattedTextField3.getText();
         double hectare = Double.parseDouble(cultivationSize);

Now the problem is that when i enter more than 3 digits, by default the comma is entered after 3 digits, e.g. 1,000. I have to add this value to some other value. But, due to this comma,I am unable to do it.

How can I remove comma and add this value to some other value?

like image 811
charan Avatar asked Nov 22 '25 09:11

charan


1 Answers

Call the getValue() instead of getText() on JFormattedTextField

like image 168
naikus Avatar answered Nov 24 '25 21:11

naikus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!