本帖最后由 古银平 于 2012-11-3 17:14 编辑
package day10;
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Label;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Sample05 extends Applet implements ActionListener{
Label info;
TextField input;
double d = 0.0;
public void input(){
info = new Label("请输入要转换的硬币数目");
input = new TextField(15);
add(info);
add(input);
input.addActionListener(this);
}
public void paint(Graphics g){
g.drawString("转换为人民币为:" +d , 25 , 70);
}
public void actionPerformed(ActionEvent e) {
d = (Double.valueOf(input.getText()).doubleValue())*10.356;
repaint();
}
}
怎么出不来文本框啊~~~
|
|