Topic: 一个APPLET小程序一晚上了但就是出错.

  Print this page

1.一个APPLET小程序一晚上了但就是出错. Copy to clipboard
Posted by: sss6586576
Posted on: 2004-12-07 21:35

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class aaa extends Applet implements ActionListener{

bbb ddd;

public aaa() {
ddd=new bbb();
ddd.b1.addActionListener(this);
ddd.b2.addActionListener(this);
}
public void init()
{
this.add(ddd);
ddd.show(true);

}
public void actionperformed(ActionEvent e){
Object a=e.getSource();
if(a==ddd.b1)
System.out.println("aaa");

}
}
class bbb extends Panel {

Label l1,l2,l3,l4,l5,l6;
TextField t1,t2,t3,t4,t5;
TextArea t6;
Button b1,b2;
public bbb(){
l1=new Label("name");
l2=new Label("telephone");
l3=new Label("fix");
l4=new Label("address");
l5=new Label("E-mail");
l6=new Label("another");
t1=new TextField(6);
t2=new TextField(10);
t3=new TextField(10);
t4=new TextField(10);
t5=new TextField(10);
t6=new TextArea(5,10);
b1=new Button("aa");
b2=new Button("bb");

this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(l1);
this.add(t1);
this.add(l2);
this.add(t2);
this.add(l3);
this.add(t3);
this.add(l4);
this.add(t4);
this.add(l5);
this.add(t5);
this.add(l6);
this.add(t6);
this.add(b1);
this.add(b2);

}
}

说aaa是抽象的,不能用接口.我觉得它应该实现的呀.能帮帮我吗??

2.Re:一个APPLET小程序一晚上了但就是出错. [Re: sss6586576] Copy to clipboard
Posted by: Lawme
Posted on: 2004-12-07 22:39

 public void actionperformed(ActionEvent e){

应该是:
public void actionPerformed(ActionEvent e){

P是大写不是小写

3.Re:一个APPLET小程序一晚上了但就是出错. [Re: sss6586576] Copy to clipboard
Posted by: tcxmn
Posted on: 2004-12-07 23:13

楼上的好眼力,一语中地!

4.Re:一个APPLET小程序一晚上了但就是出错. [Re: sss6586576] Copy to clipboard
Posted by: sss6586576
Posted on: 2004-12-08 12:08

天呀!!!我是从documents里查的方法呀,并复制的.这是怎么回事呀??谢谢二楼!!!!!!

5.Re:一个APPLET小程序一晚上了但就是出错. [Re: sss6586576] Copy to clipboard
Posted by: whlmdcg
Posted on: 2004-12-08 19:58

不是把,这会敢是复制的?


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923