Is there a way (e.g., via an event?) to determine when a Swing component becomes 'displayable' -- as per the Javadocs for Component
.getGraphics?
The reason I'm trying to do this is so that I can then call getGraphics()
, and pass that to my 'rendering strategy' for the component.
I've tried adding a ComponentListener
, but componentShown
doesn't seem to get called. Is there anything else I can try?
Thanks.
And additionally - is it ok to keep hold of the Graphics
object I receive? Or is there potential for a new one to be created later in the lifetime of the Component
? (e.g., after it is resized/hidden?)