- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 java swing 应用程序,每次我删除 jtable 中的一行时,它都会发出蜂鸣声。
有人知道如何防止这种情况发生,或者至少知道是什么原因造成的吗?
最佳答案
从这里:https://www.java.net/node/687490
On Windows, pressing the Alt key moves the keyboard focus to the window menu in the top left corner. This focus is invisible, and it even does not send a "focus lost" event. But if you press and release Alt and then press the up or down arrow, the window menu will show up.
Luckily, it's possible to prevent this functionality of the Alt key:
addKeyListener( new KeyAdapter() {
public void keyPressed(KeyEvent e) {
System.out.println("keyPressed code=" + e.getKeyCode());
e.consume();
} } );
e.consume( ) prevents the event to be processed by usual rules. This prevents the Alt key from moving the focus to the window menu, and further alphanumeric keys continue to function as usual. You may want to check the event code and consume only Alt keys, if something else stops working.
关于java - 如何禁用按下删除键时的 Windows 蜂鸣声,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28523652/
我是一名优秀的程序员,十分优秀!