我看到两个问题的Java代码,希望用户按TAB键,当代码在Chrome运行作为appletTAB键
首先,貌似没有被发现的新闻。
更多nastily在IE9按TAB失去焦点的小程序完全。
我已经看到这些报道过,但我的搜索,到目前为止,如果有一个解决方案并没有提出很好地解决,甚至是一个快速的答案......不是吗?
运行作为桌面或在webstart/JNLP应用TAB效果很好,只在小程序它会导致混乱。
我看到两个问题的Java代码,希望用户按TAB键,当代码在Chrome运行作为appletTAB键
首先,貌似没有被发现的新闻。
更多nastily在IE9按TAB失去焦点的小程序完全。
我已经看到这些报道过,但我的搜索,到目前为止,如果有一个解决方案并没有提出很好地解决,甚至是一个快速的答案......不是吗?
运行作为桌面或在webstart/JNLP应用TAB效果很好,只在小程序它会导致混乱。
我知道它的晚回答这个问题,但如果还是别人面对同样的问题 则希望这将有助于。下面的链接 解决我的问题。 http://dogfeathers.com/mark/java7issue.html
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) {}
}
在代码框之外的答案中有一点点评论有助于理解代码背后的概念。代码是什么问题的答案。 –
参考java的错误http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456655 –
你的问题是在这里吗?我们是否可以确认行为,有一个解决方法,一个错误修正,一个建议哪个键可以代替? –
@userunknown“到目前为止搜索没有提出一个整洁的解决方案,或者即使解决方案存在,甚至快速回答” –