<Swing Dev> Weird focus problem with JTextField

pavel porvatov pavel.porvatov at oracle.com
Thu Oct 4 12:57:14 UTC 2012


Hi Clemens,

Could you please write more details about your environment? (jre 
version, browser).

I tried your example and it worked with Chrome and
Java Plug-in 1.6.0_35
Using JRE version 1.6.0_35-b10 Java HotSpot(TM) Client VM

It also worked under applet viewer with jdk1.8.0b58

Regards, Pavel

On 14.09.2012 3:36, Clemens Eisserer wrote:
> Hi Pavel,
>
> I was able to distill the problem to small, self-contained testcase,
> which is available at: http://93.83.133.214/textfielddemo.zip
> I've also created a short video, demonstrating the issue:
> http://youtu.be/r1JDj5BuBOM
>
> The JTextField opens up a JPopupMenu on<ENTER>, which can be closed
> by clicking the JButton it contains.
> However, after the popup is hidden, no editing is possible unless
> focus is toggled once between the browser and another window.
>
> Unfourtunatly the testcase only triggers the problem on Linux (tested
> with jdk8+oracle plugin as well as openjdk7+icedtea-web both with
> recent versions Firefox and Chrome), However, I've seen this issue
> happen on Windows too when running the application I talked in the
> first email.
>
> It would be great if you could have a look.
>
> Thank you in advance, Clemens
>
>
> 2011/7/30 Pavel Porvatov<pavel.porvatov at oracle.com>:
>> Hi Clemens,
>>
>>> Hi,
>>>
>>> I've developed a database applet where Swing widgets are connected to
>>> RowSets using the SwingSet library (an old sourceforge project).
>>> All queries are executed on the EDT, except for some background tasks
>>> which sync with the UI using SwingUtilities.invokeLater().
>>>
>>> When running the application over high-latency connections (EDT is busy
>>> for a few seconds), sometimes after a pending operation is finished I can't
>>> edit any JTextFields. The mouse-cursor changes when I move it over the
>>> JTextField, but when I click into the JTextField the carret simply does not
>>> appear - everything else (JMenu, JButtons, ...) works as expected - so I
>>> guess event delevery is still working as expected.
>>> To make JTextField-editing work again, I have to transfer focus to another
>>> native window and back to the browser-window. A heavyweight JMenu makes it
>>> work again too, whereas a lightweight one doesn't help.
>>>
>>> Even worse, the problem does not manifest itself with low-latency
>>> connections or when running as application.
>>>
>>> I am completly puzzled :/
>>> Any idea what could be the problem, or where / what for I should start
>>> looking?
>> First of all it's not a good idea to keep the EDT thread busy for a long
>> time and I think the best way is to rewrite application.  Could you please
>> make a small separated application that emulates EDT blocking and shows the
>> problem?
>>
>> Regards, Pavel



More information about the swing-dev mailing list