标题:菜鸟求助:程序为何无法中止?
只看楼主
ccj_999
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-5-24
 问题点数:0 回复次数:0 
菜鸟求助:程序为何无法中止?
import java.awt.*;
import java.awt.event.*;
public class TwoListenInner
{
private Frame f;
private TextField tf;
public static void main(String args[])
{
TwoListenInner that=new TwoListenInner();
that.go();
}
public void go()
{
f=new Frame("Two listeners example");
f.add("North",new Label("Click and drag the mouse"));
tf=new TextField(30);
f.add("South",tf);
f.addMouseMotionListener(new MouseMotionHandler());
f.addMouseListener(new MouseEventHandler());
f.setSize(300,300);
f.setVisible(true);
}
public class MouseMotionHandler extends MouseMotionAdapter
{
public void mouseDragged(MouseEvent e)
{
String s="Mouse Dragging:X="+e.getX()+"Y="+e.getY();
tf.setText(s);
}
};
public class MouseEventHandler extends MouseAdapter
{
public void mouseEntered(MouseEvent e)
{
String s="The Mouse Entered!";
tf.setText(s);
}
public void mouseExited(MouseEvent e)
{
String s="The Mouse Left the Building!";
tf.setText(s);
}
};
};
搜索更多相关主题的帖子: void class private example public 
2006-08-09 17:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-83066-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014220 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved