| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 632 人关注过本帖
标题:[求助]我能看懂英文,但还是不知道错在哪?
取消只看楼主 加入收藏
tgllz
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2005-12-11
收藏
 问题点数:0 回复次数:3 
[求助]我能看懂英文,但还是不知道错在哪?

图片附件: 游客没有浏览图片的权限,请 登录注册


代码。
import java.awt.*;
import java.awt.event.*;
public class MultListener implements MouseListener,MouseMotionListener,WindowListener

{
private Frame f;
private TextField tf;

public static void main(String [] args)
{
MultListener ml = new MultListener();
ml.go();
}
public void go()
{
Frame f = new Frame("多个监听者");
f.add( new Label("单击和拖动鼠标"),"North");
tf = new TextField(30);
f.add( tf,"South");

f.addMouseListener(this);
f.addMouseMotionListener(this);
f.addWindowListener(this);
f.resize(200,200);
f.show();
}
public void mouseDragged(MouseEvent e)
{
String s = "Mouse dragging : X = "+e.getX()+" Y = "+e.getY();
tf.setText(s);
}
public void mouseMoved(MouseEvent e){}
public void mouseEntered(MouseEvent e)
{
String s = "The mouse Exited";
tf.setText(s);
}
public void mouseClicked(MouseEvent e){}
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}

public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowClosed(WindowEvent e){}
public void windowOpened(WindowEvent e){}
public void windowIconified(WindowEvent e){}
public void windowDeiconified(WindowEvent e){}
public void windowDeactivated(WindowEvent e){}
public void windowActivated(WindowEvent e){}
}

搜索更多相关主题的帖子: 英文 
2006-12-23 20:48
tgllz
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2005-12-11
收藏
得分:0 
我该怎么实现啊???

好好学英文!
2006-12-23 21:05
tgllz
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2005-12-11
收藏
得分:0 

呵呵~~改好了~谢谢斑竹```
我还是不认真啊 马虎了~mouseExited漏了`
import java.awt.*;
import java.awt.event.*;
public class MultListener implements MouseListener,MouseMotionListener,WindowListener

{
private Frame f;
private TextField tf;

public static void main(String [] args)
{
MultListener ml = new MultListener();
ml.go();
}
public void go()
{
Frame f = new Frame("多个监听者");
f.add( new Label("单击和拖动鼠标"),"North");
tf = new TextField(30);
f.add( tf,"South");

f.addMouseListener(this);
f.addMouseMotionListener(this);
f.addWindowListener(this);
f.resize(200,200);
f.show();
}
public void mouseDragged(MouseEvent e)
{
String s = "Mouse dragging : X = "+e.getX()+" Y = "+e.getY();
tf.setText(s);
}
public void mouseMoved(MouseEvent e){}
public void mouseEntered(MouseEvent e)
{
String s = "The mouse Entered";
tf.setText(s);
}
public void mouseExited(MouseEvent e)
{
String s = "The mouse Exited";
tf.setText(s);
}
public void mouseClicked(MouseEvent e){}
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}

public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public void windowClosed(WindowEvent e){}
public void windowOpened(WindowEvent e){}
public void windowIconified(WindowEvent e){}
public void windowDeiconified(WindowEvent e){}
public void windowDeactivated(WindowEvent e){}
public void windowActivated(WindowEvent e){}
}


好好学英文!
2006-12-23 21:14
tgllz
Rank: 1
等 级:新手上路
帖 子:36
专家分:0
注 册:2005-12-11
收藏
得分:0 
谢谢~我基础打了很久了,就是很少碰壁,现在多难为下自己,多碰碰,有好处。

好好学英文!
2006-12-24 02:02
快速回复:[求助]我能看懂英文,但还是不知道错在哪?
数据加载中...
 
   



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

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