首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Java小程序中的Tab键

Java小程序中的Tab键
EN

Stack Overflow用户
提问于 2012-06-13 20:11:07
回答 2查看 1.1K关注 0票数 0

我发现Java代码有两个问题,当代码作为applet运行时,Java代码需要用户按TAB键

首先,在Chrome中,媒体似乎没有被检测到。

更糟糕的是,在IE9中,按TAB完全失去了对小程序的关注。

我以前见过这些报道,但我的搜索到目前为止没有提出一个整洁的解决方案,甚至没有一个快速的答案,如果有解决方案存在的话……是吗?

作为桌面或WebStart/JNLP应用程序TAB运行得很好,只有在applet中才会变得混乱。

EN

回答 2

Stack Overflow用户

发布于 2012-10-22 17:48:13

我知道现在回答这个问题为时已晚,但如果其他人也面临同样的问题,那么希望这能有所帮助。下面的链接解决了我的问题。http://dogfeathers.com/mark/java7issue.html

票数 3
EN

Stack Overflow用户

发布于 2013-09-04 23:32:47

代码语言:javascript
复制
 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) {}
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11014547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档