Problem with JGoImage


#1

I have some problems to copy/paste a JGoNode with a JGoImage. The problem is that my JGoImage isn’t build from a file. I fill it with the method loadImage(Image, boolean).
Unfortunately, the JGoImage seems to can’t keep my Image, when I copy/paste my node.
Do you have any suggestion?


#2

Yes, Images aren’t serialized, so they are not copied along with the rest of the JGoObjects.
You’ll need to have some other state associated with the JGoImage that can be used to reconstruct the appropriate Image. JGoImage has two kinds of state already: String (for filenames) and URL (for resources or web references). You can override paint to see if getImage() returns null. If so, build the Image you need and call loadImage(Image, boolean) and call the super method.