File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Question about drawimage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Question about drawimage" Watch "Question about drawimage" New topic

Question about drawimage

zhong hb

Joined: Oct 18, 2005
Posts: 7
I want to draw a image on a rectangle,the code is:

int x = rectangle.getX();
int y = rectangle.getY();

int w = rectangle.getWidth();
int h = rectangle.getHeidht();

ImageIcon icon = new ImageIcon(imageName);
Image image = icon.getImage();

AffineTransform at = new AffineTransform();

because the forum can't show image, I take a char 'A' to replace image.under jre1.4.1, the result is 'A',which is good. but under jre1.5.0,'A''A''A'is showing. Why?? Thanks!
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
You can't post images to this forum?

News to me!

There is no emoticon for what I am feeling!
zhong hb

Joined: Oct 18, 2005
Posts: 7
Thank you. I find that AffineTransform is a key for image showing.
if the scale is suitable, the showing is good.
[ November 10, 2005: Message edited by: zhong hb ]
I agree. Here's the link:
subject: Question about drawimage
It's not a secret anymore!