2012-06-13 6 views
0
나는 코드가 크롬에

TAB 키를

첫째 애플릿으로 실행되고 사용자가 TAB 키를 눌러 기대 자바 코드, 두 가지 문제를보고 있어요

, 언론은 겉으로는 감지되지 않습니다.

더 이상 IE9에서 Tab을 누르면 애플릿에 초점을 잃습니다.

이전에보고 된 내용을 본 적이 있지만 지금까지 검색 한 내용이 해결책이 없다면 깔끔한 해결책이나 빠른 답변을 제안하지 않았습니다 ... 그렇습니까?

데스크톱 또는 WebStart/JNLP 앱으로 실행하면 TAB이 제대로 작동하지만 애플릿에서만 문제가 발생합니다.

+1

는 자바 버그 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456655 –

+0

질문이 여기에 무엇을 참조? 우리가 행동을 확인할 수 있는지, 해결 방법, 버그 수정, 대신에 사용하기위한 제안? –

+0

@userunknown "지금까지의 검색은 깔끔한 해결책을 제시하지 못했습니다. 또는 해결책이있는 경우 빠른 답변도 있습니다." –

답변

0
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) {} 
    } 
+1

코드 상자 외부의 답변에 대한 약간의 주석은 코드의 개념을 이해하는 데 도움이됩니다. 그리고 그 코드에 대한 답은 바로 답입니다. –

관련 문제