Thursday, 8 August 2013

HOW TO CONVERT TEMPRATURE IN FARANITE  AND CELCIUS    USE THE FOLLOWING SCRIPT IN NETBEANS AND CHANGE TEXTFEILD NAME ACORDINGLY




SCRIPT FOR CONVERT BUTTON
        int ch=0;
        if(opt1.isSelected())
        {ch=1;}
        if(opt2.isSelected())
        {ch=2;}
        int f,c;
        double c1=0,f1=0;
        switch(ch)
        {case 1:
             f=Integer.parseInt(txttemp.getText());
             c1=5.0/9*(f-32);
             txtcon.setText(" "+Math.round(c1));
             break;
            case 2:
                c=Integer.parseInt(txttemp.getText());
                f1=1.8*c+32;
                txtcon.setText(" "+Math.round(f1));
                break;
default:
                txtcon.setText("invalid choice!!");

}

SCRIPT FOR EXIT BUTTON

 System.exit(0);

No comments:

Post a Comment