How to set double data type in tot text field

I want to divide a double and show it in the text field. when I tried to set it in to set field it’s not showing. I tried several tutorials but it want to help this problem. here is the java code I tried:

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        double Width=Integer.parseInt(jTextField1.getText());
        double Hight=Integer.parseInt(jTextField2.getText());
        double SqFt=Width*Hight;
        double SqInch =SqFt/144;
        String r = String.valueOf(SqInch);


I want to divide decimal numbers (ex:1.222,2.5) and display in it a text field but when I try this code it want show in the text field.

>Solution :

have you initialized the textField correctly? can u send the code where it’s initialized?

also if you want to convert the text into double use:

Leave a Reply