Screenshots of components and resizing/rotating Icons
I'm currently making a card game in which I have one large view (to view the details of the card), and a field on which there are various small cards. I want the small cards to be miniature versions of the large one, so to make this I'd need to get a 'screenshot' of the component (as an Icon), which I'll need to resize (and in some cases rotate). The large component is LargeCardView, a simple extension of JPanel. While there is an instance of LargeCardView on the screen I'd prefer to use an invisible copy LargeCardView (which isn't on the screen (so that the one on the screen is not used (every card should have a miniature, and only the highlighted card should be shown in the LargeCardView which is visible))).
I currently have no idea how to get this 'screenshot', nor do I know how to resize and rotate the resulting Icon.
I hope this is the correct forum to post this. Some help with this would really be apreciated...
[958 byte] By [
clsa] at [2007-10-3 3:08:26]

> so to make this I'd need to get a 'screenshot' of the component
You don't need a screen shot. You just need to resize the current image:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=747638
> and rotate the resulting Icon.
http://java.sun.com/docs/books/tutorial/2d/display/transforming.html
FYI: At one stage I remember seeing playing card fonts on the net.So you don't need to draw the cards, just select the special font and draw them as characters.regards,Owen
I'm afraid I wasn't really clear on this: it isn't really a card game like patience or the likes, but more like magic, the gathering, yugioh and pokemon card games. That means I have a panel containing the card. On this panel, there are a background picture, a picture of the monster/whatever, and a few JLabels containing name, description etc. This large card is shown on one component, but i'd need a miniature version to use on the field itself...
clsa at 2007-7-14 20:58:56 >

Hmm... A few posts above this I read something about a BufferedImage, which appears to help in this case. My only problem is that it only paints the Background of the JPanel, and not its components... Using paintComponents I get a nullpointerexception... I'd really apreciate it if someone could help me out with the last problem (as to make sure that it also shows the components on the panel)
clsa at 2007-7-14 20:58:56 >

The solution you gave is to resize an image, but I not only need to resize it, but I also need to GET it. A card in this game is more than just a picture: it's a panel with background containing various JLabels. I want the Image to have all the texts on it too. So it's more than just resizing the icons (of which i now know how to do it). I assume I'll have to make it using a BufferedImage, but I don't know how to get all the contents of the component (by using paintcomponent(Graphics g) I only get the background, and not the components on the JPanel)
So basically I have a JPanel that looks somewhat like this:
http://oce.spsu.edu/programs/kids/camppages/tims/images/yugioh-cards-dcs_1767_4643154.jpg
The texts on the card are JLabels, as is the picture of the monster etc.
I need to get it ALL into an Image, which I can resize afterwards...
clsa at 2007-7-14 20:58:56 >

I guess I don't understand the problem. Presumably you have to "get" the large image from somewhere in the first place, so you just make a small image at the same time.
But I guess you are saying you want to create an image of any component dynamically in which case search the forum using "screenimage" for my class that does this.