在我的applet上放了一个jTextArea,在它上面加了一定的监听器,可以被拖动。
现在的问题就是,有的时候焦点回一直停留在页面的地址拦上,即使点了jTextArea它也没办法获得焦点。我的代码中,在jTextArea的mouseReleased里,我已经写了jTextArea.requestFocus();了。。
请问这个是什么原因呢?
现在的问题就是,有的时候焦点回一直停留在页面的地址拦上,即使点了jTextArea它也没办法获得焦点。我的代码中,在jTextArea的mouseReleased里,我已经写了jTextArea.requestFocus();了。。
请问这个是什么原因呢?
我的applet在我开发的机器上测试过,没有任何问题但是换了一台机器测试就出现了这个焦点问题
症状主要是:原本能拖动的控件仍然可以正常工作,但是整个applet中所有的可以输入文本的控件都不能获取焦点,焦点一直停留在地址拦上。
这个急待解决,期待高手帮助
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)
那就换个JDK试试