import java.awt.*;
import java.applet.*;
import java.awt.Event.*;
import java.awt.event.*;
;
public class doller extends Applet implements ActionListener{
TextField tf1,tf2;
Button b1;
Label l1,l2;
String s1,s2;
int a,b;
public void init()
{
l1=new Label("Enter the Doller Value");
tf1=new TextField(5);
b1=new Button("Submit");
l2=new Label("INR Value");
tf2=new TextField(5);
add(l1);
add(tf1);
add(b1);
b1.addActionListener(this);
add(tf2);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==b1)
{
s1=tf1.getText();
a=Integer.parseInt(s1);
b=a*50;
s2=String.valueOf(b);
tf2.setText(s2);
}
}
}
in this program the float value is not work;
so please give me the idea for use float value.
thank you,
doubtAraneesh rajan April 8, 2012 at 9:13 PM
import java.awt.*; import java.applet.*; import java.awt.Event.*; import java.awt.event.*; ; public class doller extends Applet implements ActionListener{ TextField tf1,tf2; Button b1; Label l1,l2; String s1,s2; int a,b; public void init() { l1=new Label("Enter the Doller Value"); tf1=new TextField(5); b1=new Button("Submit"); l2=new Label("INR Value"); tf2=new TextField(5); add(l1); add(tf1); add(b1); b1.addActionListener(this); add(tf2); } public void actionPerformed(ActionEvent e) { if(e.getSource()==b1) { s1=tf1.getText(); a=Integer.parseInt(s1); b=a*50; s2=String.valueOf(b); tf2.setText(s2); } } } in this program the float value is not work; so please give me the idea for use float value. thank you,
Post your Comment