Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java SE 综合讨论区
打印话题 寄给朋友 订阅主题 |
作者 | 请帮忙看一下程序错在哪 |
haoyue
发贴: 24 积分: 0 |
于 2004-08-03 14:49
import java.awt.*; import java.awt.event.*; public class MultipleEventTester extends Frame implements WindowListener,MouseListener,KeyListener { public MultipleEventTester() { addWindowListener(this); addMouseListener(this); addKeyListener(this); setSize(200,200); show(); } //窗口处理事件方法 public void windowClosing(WindowEvent e) { System.exit(0); } public void windowOpened(WindowEvent e) { System.out.println("Window opened"); } public void windowIconified(WindowEvent e) { System.out.println("Window iconified"+e); } public void windowDeiconified(WindowEvent e) { System.out.println("window deiconified"+e); } public void windowClosed(WindowEvent e) { System.out.println("Window closed"+e); } public void windowActivated(WindowEvent e) { System.out.println("Window activated"+e); } public void windowDeactivated(WindowEvent e) { System.out.println("window deactivated"+e); } //鼠标事件处理方法 public void MousePressed(MouseEvent e) { System.out.println("Mouse pressed"+e); } public void MouseReleased(MouseEvent e) { System.out.println("Mouse release"+e); } public void MouseEntered(MouseEvent e) { System.out.println("Mouse dntered"+e); } public void MouseExited(MouseEvent e) { System.out.println("Mouse exited"+e); } public void MouseClicked(MouseEvent e) { System.out.println("Mouse Clicked"+e); } //键盘事件处理方法 public void keyPressed(KeyEvent e) { System.out.println("Key pressed"+e); } public void keyReleased(KeyEvent e) { System.out.println("Key released"+e); } public void keyTyped(KeyEvent e) { System.out.println("Key type"+e); } public static void main(String args[]) { MultipleEventTester p=new MultipleEventTester(); } } 我有一点感想和初学者们同享(原创) |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
3272 | 请帮忙看一下程序错在哪 | haoyue | 2017 | 2004-08-03 14:49 |
2254 | Re:请帮忙看一下程序错在哪 | zslzx | 27 | 2004-08-03 23:52 |
2535 | Re:请帮忙看一下程序错在哪 | haoyue | 4 | 2004-08-04 09:33 |
已读帖子 新的帖子 被删除的帖子 |
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 |