This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Graphics problem , how to approach ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Graphics problem , how to approach ?" Watch "Graphics problem , how to approach ?" New topic
Author

Graphics problem , how to approach ?

Tirthankar Mukherjee
Ranch Hand

Joined: Apr 08, 2006
Posts: 51
I am trying to repaint a component. Putting a image on a panel the applying graphics change in it (like drawing polygon, rectangle ..).


I would like to take the backup of the image passed to the class, and restore the graphics of the Component on need.

Problems I am facing :

1) Cannot make a clone for Image class.
2) Taking the backUp in BufferedImage using

3) Trying to restore the image with


seems not working.

NB : repaint() is always there.

Thanks in advance.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 5048
    
  10

drawImage(..) the original image to the Graphics context of the backup image.


luck, db
There are no new questions, but there may be new answers.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 5048
    
  10

Tirthankar Mukherjee wrote:
3) Trying to restore the image with

You do realize that after that line executes, you have two references to the same BufferedImage, don't you?

Also, I can't see why a cast to Image would be needed. What's the Type of imageBackUp?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Graphics problem , how to approach ?
 
It's not a secret anymore!