这么简单的程序,我不明白错在哪了,电脑就是运行不了,哪位高人帮忙解决!
import java.awt.*;
import java.awt.enent.*;
import java.applet.*;
public class Example18_3 extends Applet implements MouseListener
{ TextField text;Button button;
TextArea textArea;
public void init()
{ text=new TextField(10);
text.addMouseListener(this);
button=new Button("按钮");
button.addMouseListener(this);
addMouseLIstener(this);
textArea=new TextArea(8,28);
add(button);add(text);add(textArea);
resize(300,300);
}
public void mousePressde(MouseEvent e)
{
if(e.getSource()==button)
{
textArea.append("\n在按钮上鼠标按下,位置:"+"("+e.getX()+","+e.getY()+")"+"\n");
}
else if(e.getSource()==text)
{
textArea.append("\n在文本框上鼠标按下,位置:"+"("+e.getX()+","+e.getY()+")"+"\n");
}
else if(e.getSource()==this)
{
textArea.append("\n在容器上鼠标按下,位置:"+"("+e.getX()+","+e.getY()+")"+"\n");
}
}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseClicked(MouseEvent e)
{
if(e.getClickCount()>=2)
{
textArea.setText("鼠标连击,位置:"+"("+e.getX()+","+e.getY()+")"+"\n");
}
}
public void paint(Graphics g)
{
g.drawString("鼠标按钮事件!", 50, 50);
}
}
问题点数:20、回复次数:6Top
1 楼wjg259675(郁闷的鱼)回复于 2005-04-04 00:50:22 得分 0
我检查一好几遍,就是找不到错的地方,求哪位高人帮忙解决!Top
2 楼simonxuluo(爱江山更爱美人)回复于 2005-04-04 01:33:39 得分 8
晕,你老拼写错误!
import java.awt.enent.*; // enent --> event
addMouseLIstener(this); // addMouseLIstener --> addMouseListener
public void mousePressde(MouseEvent e) // mousePressde --> mousePressedTop
3 楼apollo333()回复于 2005-04-04 02:06:20 得分 3
上边的问题都能出现,楼主要细心了。
为什么不用IDE来运行你的程序,象JBuilder, Eclipse等等。有什么错误会自动显示,或者在运行后有提示,很方便。Top
4 楼midthinker(呵呵)回复于 2005-04-04 02:36:03 得分 3
其实学会仔细观察错误提示,就应该能够大致了解大多数错误可能发生的根源,在这点上SUN的JDK编译器还是做得非常不错的。
@.@||~Top
5 楼OnlyFor_love(『勾勾手指头 一辈子不分手』)回复于 2005-04-04 09:30:55 得分 3
强烈希望楼主改用JBuilder,对于初学者还是用JBuilder的好,Eclipse以后等你厉害了再用!
况且JBuilder有内置的jdk,所以你不用安装jdk的Top
6 楼topil(认认真真学习,塌塌实实工作)回复于 2005-04-04 10:31:22 得分 3
路过,楼主加油Top




