0

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.

4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by mKorbel
0

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

0

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 by mKorbel: n/a

0

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.

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.