focus issue with popups

Glen Schrader gschrader at gmail.com
Fri Sep 21 15:20:00 PDT 2012


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.

Thanks,
Glen



More information about the caciocavallo-dev mailing list