在我的applet上放了一个jTextArea,在它上面加了一定的监听器,可以被拖动。
现在的问题就是,有的时候焦点回一直停留在页面的地址拦上,即使点了jTextArea它也没办法获得焦点。我的代码中,在jTextArea的mouseReleased里,我已经写了jTextArea.requestFocus();了。。
请问这个是什么原因呢?

解决方案 »

  1.   

    现在的问题就是。。鼠标点了jTextArea也没有获得焦点,焦点还停在地址栏上哦。。
      

  2.   

    更新下这个问题
    我的applet在我开发的机器上测试过,没有任何问题但是换了一台机器测试就出现了这个焦点问题
    症状主要是:原本能拖动的控件仍然可以正常工作,但是整个applet中所有的可以输入文本的控件都不能获取焦点,焦点一直停留在地址拦上。
    这个急待解决,期待高手帮助
      

  3.   

    再把出现的异常信息贴下。。
    Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException
    at java.util.Hashtable.get(Unknown Source)
    at javax.swing.KeyboardManager.registerMenuBar(Unknown Source)
    at javax.swing.JMenuBar.addNotify(Unknown Source)
    at java.awt.Container.addNotify(Unknown Source)
    at javax.swing.JComponent.addNotify(Unknown Source)
    at com.birosoft.liquid.LiquidTitlePane.addNotify(LiquidTitlePane.java:227)
    at java.awt.Container.addNotify(Unknown Source)
    at javax.swing.JComponent.addNotify(Unknown Source)
    at java.awt.Container.addNotify(Unknown Source)
    at javax.swing.JComponent.addNotify(Unknown Source)
    at javax.swing.JRootPane.addNotify(Unknown Source)
    at java.awt.Container.addNotify(Unknown Source)
    at java.awt.Window.addNotify(Unknown Source)
    at java.awt.Frame.addNotify(Unknown Source)
    at java.awt.Window.pack(Unknown Source)
    at sun.awt.im.CompositionArea.<init>(Unknown Source)
    at sun.awt.im.CompositionAreaHandler.createCompositionArea(Unknown Source)
    at sun.awt.im.CompositionAreaHandler.inputMethodTextChanged(Unknown Source)
    at sun.awt.im.CompositionAreaHandler.processInputMethodEvent(Unknown Source)
    at sun.awt.im.InputMethodContext.dispatchEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
      

  4.   

    自己的程序没有问题
    那就换个JDK试试
      

  5.   

    用了jdk1.5,还是不行哦。。还有其他解决方法吗
      

  6.   

    最后发现了liquid皮肤的问题用了这个皮肤在部分电脑上会出现无法获得焦点的问题,原因不明如果用substance皮肤可能出现中文无法显示的问题只能忍痛放弃皮肤了。。