简体   繁体   English

返回TextField使AWT中的BING

[英]Return TextField makes BING in AWT

Why does a return inside a TextField in Java AWT make a bing sound in dialogs? 为什么在Java AWT中的TextField内部返回会在对话框中发出嗡嗡声? I have an old AWT program here, and run it under Java 7. It does not seem to matter, if the TextField has an action listener or not. 我这里有一个旧的AWT程序,并在Java 7下运行。无论TextField是否具有动作侦听器,这似乎都没有关系。

Update: I tried to isolate the problem writing another application with a dialog, but there is no beep. 更新:我试图通过对话框隔离编写另一个应用程序的问题,但是没有提示音。 I also noticed that cursor up and down work in one program and in the other they cause a bing. 我还注意到,在一个程序中上下移动光标会在其他程序中引起麻烦。 However, there is no obvious code which is called to handle keystrokes. 但是,没有明显的代码可用来处理击键。

Update: I also discovered that the right mouse button does not work in the beeping application. 更新:我还发现鼠标右键在蜂鸣应用程序中不起作用。

Thanks for answers and help. 感谢您的回答和帮助。

Perhaps it is using Toolkit.getDefaultToolkit().beep(); 也许它正在使用Toolkit.getDefaultToolkit().beep(); to indicate you pressed return when no text is present or for other validation reasons? 在没有文字或其他验证原因时指示您按回车键?

This may be invoked via the look-and-feel. 这可以通过外观来调用。 Is this application loading some custom look-and-feel? 该应用程序是否加载了一些自定义外观? If so, try disabling it and see if the behavior goes away. 如果是这样,请尝试禁用它,然后查看行为是否消失。

我发现了问题:它是Java7。在Java 6中一切正常。这是Oracle的工作,可能对此我们无能为力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM