> > ...How do I scale the image to the size of
> > the window?
[quoted text clipped - 12 lines]
> Andrew T.
> PhySci.org
Thanks for the reply, but it didn't work. I'm using ImageIcon and not
Image. I need to use ImageIcon.
Stanimir Stamenkov - 14 Jan 2008 15:55 GMT
Mon, 14 Jan 2008 07:35:38 -0800 (PST), /semi/:
>>> ...How do I scale the image to the size of
>>> the window?
[quoted text clipped - 7 lines]
> Thanks for the reply, but it didn't work. I'm using ImageIcon and not
> Image. I need to use ImageIcon.
You could try using ImageIcon.getImage() [1]:
ImageIcon icon;
...
public void paint(Graphics g) {
Image theImg = icon.getImage();
g.drawImage(theImg, 0, 0, getWidth(), getHeight(), this);
...
[1]
<http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/ImageIcon.html#getImage()>

Signature
Stanimir
semi - 14 Jan 2008 16:01 GMT
> Mon, 14 Jan 2008 07:35:38 -0800 (PST), /semi/:
>
[quoted text clipped - 24 lines]
> --
> Stanimir
Yes, that works!!! Thank you both for your help.
Roedy Green - 28 Jan 2008 00:43 GMT
On Mon, 14 Jan 2008 07:35:38 -0800 (PST), semi
<seminole10003@yahoo.com> wrote, quoted or indirectly quoted someone
who said :
>Thanks for the reply, but it didn't work. I'm using ImageIcon and not
>Image. I need to use ImageIcon.
you can extract the Image from an ImageIcon.
the additional parts are just to arrange an automatic MediaTracker.

Signature
Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com