本帖最后由 高鑫 于 2012-7-13 15:00 编辑
- import java.awt.*;
- import java.awt.event.*;
- class Hello
- {
- public static void main(String args[])
- {
- Frame f=new Frame("程序");
- f.setSize(300,300);
- f.setLocation(500,500);
- f.setLayout(new BorderLayout());
- Button but=new Button("Enter");
- f.add(but);
- f.addWindowListener(new WindowAdapter()
- {
- public void windowClosing(WindowEvent e)
- {
- System.out.println("窗口关闭");
- System.exit(0);
- }
- });
- but.addMouseListener(new MouseAdapter()
- {
- public void mouseClicked(MouseEvent e)
- {
- if(e.getClickCount()==2)
- System.out.println("鼠标双击");
- else
- System.out.println("鼠标click");
- }
- public void mouseEntered(MouseEvent e)
- {
- System.out.println("鼠标enter");
- }
- });
- but.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- System.out.println("鼠标action");
- }
- });
- f.setVisible(true);
- }
- }
复制代码 请问,为什么我在关闭图形窗口点×的时候,会出现一大段代码,请问是怎么回事,即使是老师的例题也是这样,只要关闭就出现,怎么回事啊???
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x035f3997, pid=5324, tid=5832
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode, sharing windows-x86
)
# Problematic frame:
# C [GOOGLEPINYIN2.IME+0xa3997]
#
# Failed to write core dump. Minidumps are not enabled by default on client vers
ions of Windows
#
# An error report file with more information is saved as:
# E:\\hs_err_pid5324.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
# |
|