aspose file tools*
The moose likes Java in General and the fly likes Copying panel contents to an image. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Copying panel contents to an image." Watch "Copying panel contents to an image." New topic
Author

Copying panel contents to an image.

Archer DaPunk
Greenhorn

Joined: Oct 05, 2003
Posts: 6
I'm trying to copy panel contents to an image I'm using the following code and the string "blah" gets drawen on the image. When I try and paint the image back onto the panel it paints an image with the same color as the panel background and also the text "blah"
The thing is I drawlines onto the panels graphics in another procedure but it doesn't seem to copy those lines to the image.
Anyone know why???
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8964
    
    9

Originally posted by Archer DaPunk:

The thing is I drawlines onto the panels graphics in another procedure but it doesn't seem to copy those lines to the image.

What is this other procedure and when is it called?



What are you invoking drawLine() on? I think you may be writing your lines directly on the panel, then overwriting them with the g2.drawImage() call.


[How To Ask Questions On JavaRanch]
Archer DaPunk
Greenhorn

Joined: Oct 05, 2003
Posts: 6
This is how I call the .drawline()
I send drawLine the Graphics i want to draw onto ie. tPanel.getGraphics()
I don't fully understand what all the sin and cos maths are for but it works. I got this code from my sample API for smartboards (electronic whiteboards)
I want to be able to copy these lines that i draw into an image so i can redraw it back onto the panel with an alpha channel and then still be able to draw on the panel with the smartboard.

[ October 13, 2003: Message edited by: Archer DaPunk ]
 
Consider Paul's rocket mass heater.
 
subject: Copying panel contents to an image.