JTextField tf = new JTextField(20);
Retrieve value from a textfield,
String strNum = tf.getText();
Convert a String to a number
int num = Integer.ParseInt(tf.getText());
int population = Integer.parseInt(popultaion);
// population is a string retrieved from a html file
double value = Double.parseDouble(tf.getText());
Covert numbers to a string
int i;
double d;
String s3 = Integer.toString(i);
String s4 = Double.toString(d);
Set Text on a label
JLabel label_2 = new JLabel();
label_2.setText(s3);
label_2.setText(Double.toString(total));
Declare a static variable as a global variable to accumulate total amount
private static double total =0;