JApplet的不停止或反应到键盘输入 [英] JApplet Not Stopping or Reacting to Keyboard Input

查看:145
本文介绍了JApplet的不停止或反应到键盘输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用AWT / Swing的最近尝试学习如何做小程序瞎搞。

I've been messing around with awt/swing lately trying to learn how to do applets.

我写了下面的短<一个href=\"http://github.com/ido/Useful-Examples/blob/2609473dd656209fff468e5bb8f213ad30139692/src/Example.java\"相对=nofollow> JApplet的例子code ,这在表面上似乎工作。

I have written the following short JApplet example code, which on the surface seems to work.

当我尝试退出它发生我的问题是:

The problems I have occur when I try to exit it:


  1. pressing ESC什么也不做,实际上线38永远达不到,当我在调试器中运行(也不是第94行 - 它好像重写的函数processKeyEvent(KeyEvent e而)未通过的小程序称为在关键的preSS亚军的话)。但是,鼠标事件似乎要被处理(通过调试,我可以看到99行被达到,当我移动鼠标)。

  2. 试图关闭/退出Eclipse的小程序亚军使其挂起,这意味着我必须杀死进程。通过它运行的另一个小程序时,这种情况并未发生。

  3. 印刷@是不是在正确的尺寸,我怀疑它使用的是固定宽度的字体我将它设置在第74行使用不拉丝。

任何想法,我做错了吗?

Any idea what I'm doing wrong?

-Ido。

推荐答案

看来你没有给集中到小程序。当我在Eclipse中运行它,pressing逃避什么都不做。但是当我点击了网格内,pressing逃避工作得很好。它的输出在控制台中未运行。此外,在日食关闭小应用程序工作得很好。其中Eclipse版本,你运行,哪些Java版本?

It seems that you have not given focus to the applet. When i run it in eclipse, pressing escape does nothing. but when i have clicked inside the grid, pressing escape works just fine. it outputs "not running" in the console. Also closing the applet in eclipse works just fine. Which eclipse version are you running and what Java version?

这篇关于JApplet的不停止或反应到键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆