focus issue with popups
Roman Kennke
roman at kennke.org
Mon Sep 24 03:37:51 PDT 2012
Am Freitag, den 21.09.2012, 16:20 -0600 schrieb Glen Schrader:
> I'm getting sporadic test failures, I think I've tracked it down to a
> popup stealing focus. When a failure occurs the current focus owner
> is an instance of javax.swing.Popup$HeavyWeightWindow. Unfortunately
> I can't seem to come up with a simple test case that will fail (i.e.
> getting it so that popup window steals focus). In our large test
> suite there are a handful of tests that will fail maybe 10% of the
> time.
>
> Looking through the code I question a couple of things that might be
> causing the grief. In CacioWindowPeer:
>
> public void updateFocusableWindowState() {
> // Nothing to do here for now.
> }
>
> I wonder if something needs to be done :) I wonder if a flag should be
> set so that it will ignore any focus events.
>
> or perhaps in the constructor:
>
> ((Window) awtC).setFocusableWindowState(true);
> ((Window) awtC).setFocusTraversalPolicyProvider(true);
>
> it should check to make sure that it isn't a popup before setting
> these values to true.
>
> Any ideas here? In the meantime I'll still try to come up with a test case.
Hi Glen,
Yes, the issues that you mentioned might be causing the problems. I will
look into it soon. I wonder why it's only sporadic, this seems to point
to some threading/EDT issue. Have you made sure that all your
interactions happen in the EDT? (see http://fest.codehaus.org/Writing
+EDT-safe+GUI+tests) In the meantime it would be great if you can come
up with a testcase.
Roman
More information about the caciocavallo-dev
mailing list