Posted by: Sourav | October 17, 2015

miles to kilometre converter using java swing,Sourav Bhattacharya

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
       double input=0;
       DecimalFormat df=new DecimalFormat(“#.##”);
       }catch(Exception e)
           JOptionPane.showMessageDialog(this, “Please enter a valid number”, “Error”, JOptionPane.ERROR_MESSAGE);
       String answer=df.format(input*1.609344f);
     jLabel2.setText(answer +” kilometers”);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: