我发现Java代码有两个问题,当代码作为applet运行时,Java代码需要用户按TAB键
首先,在Chrome中,媒体似乎没有被检测到。
更糟糕的是,在IE9中,按TAB完全失去了对小程序的关注。
我以前见过这些报道,但我的搜索到目前为止没有提出一个整洁的解决方案,甚至没有一个快速的答案,如果有解决方案存在的话……是吗?
作为桌面或WebStart/JNLP应用程序TAB运行得很好,只有在applet中才会变得混乱。
发布于 2012-10-22 17:48:13
我知道现在回答这个问题为时已晚,但如果其他人也面临同样的问题,那么希望这能有所帮助。下面的链接解决了我的问题。http://dogfeathers.com/mark/java7issue.html
发布于 2013-09-04 23:32:47
public void init()
{
Container topParent = null;
Container parent = this;
// The natural thing would be to call getParent() until it returns
// null, but then you would be looping for a long time, since
// PluginEmbeddedFrame's getParent() returns itself.
for (int k=0; k < 10; k++) {
topParent = parent;
parent = parent.getParent();
if (parent == null) break;
}
// If topParent isn't a KeyEventDispatcher then we must be in some
// Plugin version that doesn't need the workaround.
try {
KeyEventDispatcher ked = (KeyEventDispatcher)topParent;
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
// You have to remove it twice, otherwise the problem isn't fixed
kfm.removeKeyEventDispatcher(ked);
kfm.removeKeyEventDispatcher(ked);
} catch (ClassCastException e) {}
}https://stackoverflow.com/questions/11014547
复制相似问题