Hello every one.
Will I'm tying in my code to set a default number for the JTextField that when the user decide not to put any numbers. Like let say that I want the textfield set to 0 , so then the user do not file it it won't make any problem to the program because its already has a default number.
****************
if (stringGQ != null && stringGW != null && stringGP != null){ stringGQ = gMQ.getText(); stringGW = gMW.getText(); stringGP = gMP.getText(); weightPrice_1M = Double.parseDouble(stringGW) * Double.parseDouble(stringGP); total_GroundM += weightPrice_1M * Integer.parseInt(stringGQ); finalTotal += total_GroundM; } else{ gMQ.getText().valueOf(0); gMW.getText().valueOf(0); gMP.getText().valueOf(0); }
Note: This is a small part of my code. when I leave it empty it take the 0 as a value, However,
when I write in text field it also take the value of a 0 and the finalTotal is also = to 0
So could please someone what I'm doing wrong.
Thank you in front