Dear Jay,


        If you want the font context to be guaranteed "live" at all 
times, you could try the following:

1. create a JFrame
2. call the JFrame's addNotify() method to create its peer.
3. call getGraphics() on the JFrame.
4. use the FontRenderContext on this GC.


        That should create a FontRenderContext that will be working all 
the time.  I don't know how long the GC that comes in through the 
"paint(" method is "live", so I've been using external GCs from Frame 
classes.  Moreover I usually do some calculations before the "paint(" is 
executed, and using an external GC solves that problem too.

        Hope this helps.


Sincerely,


Thorn Green



On Fri, 5 Feb 1999, Jay Shaffstall wrote:

> I am a bit confused on the relationship between the graphics context,
> FontRenderContexts, and TextLayouts.  
> 
> What I would like to do is this: create a TextLayout, using
> Graphics2d.getFontRenderContext.  I would then like to keep that TextLayout
> around, drawing it and using it for hit detection as appropriate.  
> 
> My big question is, does the FontRenderContext remain valid via successive
> repaintings and possible changes in the scaling of the graphics context.
> Or do I need to reconstruct the text layout each time I want to either
> paint it or do hit detection?
> 
> Thanks,
> 
> Jay
> 
> 
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 2D Home Page: http://java.sun.com/products/java-media/2D/
> 
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/

Reply via email to