bumpert
asked on
Creating an Image of a invisible component
Hi, i know how to create a Image from a JComponent or anything that have a paint function. It create my Image with no problem. But now i have to create a Image Object of a JComponent that the user won't have to see. I set my Component to setVisible(false) and when i create the Image, my Image Object is null but if i setVisible(true) and i do the Image it's ok. So my question: "is there a way to create an Image Object from a Component that are not visible?"
i use this code to create the Image Object
Rectangle rect = table.getBounds();
Image ima = createImage(rect.width, rect.height);
Graphics2D g = (Graphics2D) ima.getGraphics();
table.paint(g);
g.dispose();
thx
i use this code to create the Image Object
Rectangle rect = table.getBounds();
Image ima = createImage(rect.width, rect.height);
Graphics2D g = (Graphics2D) ima.getGraphics();
table.paint(g);
g.dispose();
thx
You could only save an image of something when it's visible, so you'd have to show it then hide it.
ASKER
hummm it's not really usefull.... cause i do my picture when a bi things is loading, so the user have the time to see the component visible, and i cant do my image elsewhere...
i was thinking that somebody could have a solution for that :(
thx
i was thinking that somebody could have a solution for that :(
thx
AFAIK, that's the situation i'm afraid
ASKER
humm ok
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thx someone already answer me on the java forum, but i'll give you the points
ASKER
java sun forum, sorry :)
Sorry bumpert - for some reason, an off-screen image didn't occur to me.
ASKER
no problem man, we cannot know all the things :)
if yes i didn't post qa question here :)
thx to all for your help
im leaving this topic
if yes i didn't post qa question here :)
thx to all for your help
im leaving this topic