i had one problem is that when I either enter the value for pound convert to kg or kg convert pound, it won't apear on the result textfield and here is the codes of mine. hope someone can solve my problem~~ thank you.
this is java part
import java.applet.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class Text2 extends Applet implements ActionListener
{
TextField tf1 = new TextField(), tf2 = new TextField(),tf3 = new TextField();
Label lb1 = new Label(" kg pound converter "), lb2 = new Label("enter kg to convert pound: "),lb3 = new Label("enter pound convert to kg : "),lb4=new Label("result : ");
Button bn = new Button(" convert ");
public void init()
{
setLayout(null);
add(lb1);
add(lb2);
add(lb3);
add(lb4);
add(tf1);
add(tf2);
add(tf3);
add(bn);
bn.addActionListener(this);
lb1.setBounds( 120, 10, 150, 20);
lb2.setBounds( 40, 30, 130, 20);
lb3.setBounds( 40, 50, 130, 20);
lb4.setBounds( 40, 80, 100, 20);
tf1.setBounds( 180, 30, 100, 20);
tf2.setBounds( 180, 50, 100, 20);
tf3.setBounds( 180, 80, 100, 20);
tf3.setEditable( false );
bn.setBounds(40, 120, 60,30);
}
public void actionPerformed(ActionEvent e)
{
String s,t;
double x, y,w,z;
x = Double.parseDouble(tf1.getText());
y = x * 2.21;
w = Double.parseDouble(tf2.getText());
z = w*0.45;
if (e.getSource() == bn)
{
s = String.valueOf(y);
tf3.setText(s+" lbs");
}
if(e.getSource() == bn)
{
t=String.valueOf(z);
tf3.setText(t+" kg");
}
}
}
this is HTML part
<applet code="Text2.class" width="400" height="400">
</applet>