使用按钮接受用户输入文本例如在文本框内输入数据,通.ppt
例:import java.applet.Applet;import java.awt.*;import java.awt.event.*;//检测由用户触发的事件public class Square extends Applet implements ActionListener //用动作监听器配合按钮工作{ public Button btnSquare; //声明按钮 public TextField input; //声明文本框public Color myColor;//声明一种新颜色public int num,numSquared;
用户输入
public void init() { setBackground(Color.blue); setForeground(Color.white); btnSquare = new Button("平方"); btnSquare.setBackground(Color.red); btnSquare.set ...


雷达卡




京公网安备 11010802022788号







