I first thought this was a bug in the 1.6.0.14 plugin.  But perhaps it is just 
that the Graphics2D object retrieved from a Canvas object is volatile.  
Although I have never seen a Graphics2D object to be volatile except when it 
was retrieved from a BufferStrategy.

This is what I see.

When I dragged an applet to the desktop, I would lose my Canvas Graphics2D 
object. In other words when I init my Canvas:

canvasGraphic = (Graphics2D)this.getGraphics(); // this is a Canvas

gives me back a volitile canvasGraphic. When I drag the applet to the desktop, 
canvasGraphics is no longer valid. It's not null -- just not valid. I cannot 
use it to draw with. The applet still responds to paint(Graphics g) calls 
because g is a new Graphics object.

So when I redraw my pixel buffer, I have to get the canvasGraphics object each 
time to be sure that it is still valid like this:

I call this method now for every frame I draw when the user pans/tilts/zooms.
public void newPixels()
{
canvasGraphic= (Graphics2D)this.getGraphics(); 
canvasGraphic.drawImage(paintImage, 0, 0, thisW, thisH, this);
}

It used to look like:
public void newPixels()
{
canvasGraphic.drawImage(paintImage, 0, 0, thisW, thisH, this);
}

And the above works fine until the applet is dragged to the desktop, then 
canvasGraphic becomes invalid (or something) and drawImage() doesn't draw the 
image on the Canvas.

Is this a bug??? Is this the way it's supposed to be???  I don't know.

Open:
http://pancyl.com/

I've added the code to get a new Graphics2D object each time I draw my pixel 
buffer. It works now just like before 1.6.0.14. I don't recall ever having to 
do this.  But I was using BufferStrategy and I was getting the Graphics2D 
object each time I drew.  I changed to using an unmanaged BufferedImage that I 
draw directly onto my Canvas.  I didn't know that the Canvas graphics object 
was volatile.  I don't recall ever having to get the graphics object from the 
Canvas each time I draw into it.  Did something change?
[Message sent by forum member 'demonduck' (demonduck)]

http://forums.java.net/jive/thread.jspa?messageID=353271

===========================================================================
To unsubscribe, send email to lists...@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
lists...@java.sun.com and include in the body of the message "help".

Reply via email to