I am wondering if I could write this code to a file and then print it at a starting location (like an image).

g.setColor(Color.white);
			g.fill3DRect(en1X + 0 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 5 * enZ, en1Y - 30 * enZ, 5 * enZ, 5 * enZ, true);
			//alien body
			g.fill3DRect(en1X + 10 * enZ, en1Y - 40 * enZ, 5 * enZ, 5 * enZ, true); // left side
			g.fill3DRect(en1X + 10 * enZ, en1Y - 35 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 10 * enZ, en1Y - 30 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 10 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 10 * enZ, en1Y - 20 * enZ, 5 * enZ, 5 * enZ, true); // left side end
			g.fill3DRect(en1X + 35 * enZ, en1Y - 40 * enZ, 5 * enZ, 5 * enZ, true); // right side
			g.fill3DRect(en1X + 35 * enZ, en1Y - 35 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 35 * enZ, en1Y - 30 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 35 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 35 * enZ, en1Y - 20 * enZ, 5 * enZ, 5 * enZ, true); // right side end
			g.fill3DRect(en1X + 15 * enZ, en1Y - 45 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 30 * enZ, en1Y - 45 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 15 * enZ, en1Y - 15 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 30 * enZ, en1Y - 15 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 20 * enZ, en1Y - 10* enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 25 * enZ, en1Y - 10* enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 20 * enZ, en1Y - 50 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 25 * enZ, en1Y - 50 * enZ, 5 * enZ, 5 * enZ, true);
			// body end, Arm right start
			g.fill3DRect(en1X + 40 * enZ, en1Y - 30 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 45 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true);
			// end arms, start eyes
			g.setColor (Color.red);
			g.fill3DRect(en1X + 20 * enZ, en1Y - 40 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 30 * enZ, en1Y - 40 * enZ, 5 * enZ, 5 * enZ, true);
			// end eyes, start pinsers
			g.setColor (new Color (73,29,0));
			g.fill3DRect(en1X + 20 * enZ, en1Y - 30 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 30 * enZ, en1Y - 30 * enZ, 5 * enZ, 5 * enZ, true);
			g.setColor (new Color (135,51,0));
			g.fill3DRect(en1X + 20 * enZ, en1Y - 20 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 30 * enZ, en1Y - 20 * enZ, 5 * enZ, 5 * enZ, true);
			g.setColor (new Color (107,42,0));
			g.fill3DRect(en1X + 35 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true);
			g.fill3DRect(en1X + 15 * enZ, en1Y - 25 * enZ, 5 * enZ, 5 * enZ, true);
			// end pinsers

Thanks for any help.

I could, but I need to resize it during the program. Can I resize a picture while it is in the program?

1/ dynamically (continiously by resizing with Container == JPanel), yes its about Listening Container on resize plus recalculate Paints

2/ static (get Container==JPanel Insets) and recalculate Paints

Edited 5 Years Ago by mKorbel: n/a

Once you have your .png read into a Java Image you can use the getScaledInstance method to re-size it to any size you want,any time you want.

maybe that posible but I not sure with anitaliasing and textures efects, sure sirlink99 you have to try getScaledInstance (don't forget multiplayed exist picture pixels == hold Picture Ratio)

This article has been dead for over six months. Start a new discussion instead.