Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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);
        jTextField4.setText(r);
        jTextField3.setEditable(false);
    }

`

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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:
Double.parseDouble

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading