Have you tried listening for HierarchyEvents?
public class MyVisibilityListener implements HierarchyListener {
public void hiararchyChanged( HierarchyEvent e ) {
if( ( e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED ) != 0 ) &&
e.getChanged().isShowing() )
{
// Do something here because it's now showing!
}
}
}
We use this to set up the "default focus component" for dialogs and stuff.
So, when the component shows, the default focus component requests the
focus.
-----Original Message-----
From: esumerfd@xxxxxxxxx [mailto:esumerfd@xxxxxxxxx] On Behalf Of Edward
Sumerfield
Sent: Wednesday, October 04, 2006 11:05 AM
To: users@xxxxxxxxxx
Subject: [cinjug-users] Swing visibility
Does anyone know how to test to see if a rendered component is
actually visible to the user.
The problem we are bumping into is that a minor change in a
GridBagConstraint can shuffle components off the panel. We have tests
for isVisible and isShowing but they all seem to return true event if
the component is not there.
I have played with the graphics clipping information but don't seem to
be able to identify what is happening to the component.
The usual fix is just the shuffle some layout information and it will
eventually show up again but I want a test to tell me that it
dissapeared in the first place instead of having to way for a customer
to tell me.
--
Ed
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx
|