The argument to the getWidth() and getHeight() methods is an object which
implements the ImageObserver interface.  Since java.awt.Component
implements the ImageObserver interface - and javax.swing.JComponent
extends java.awt.Component- you can pass virtually any GUI element which
extends this class as an argument to getWidth() and getHeight().

I suspect that your FileBrowser class does not
(1) extend java.awt.Component
or
(2) implement the java.image.ImageObserver interface on its own.

In order to pass the FileBrowser class via the 'this' reference you would have to
satisfy one of the two conditions above.  Alternatively, you could simply
pass something which implements the ImageObserver interface, such as
canvas which has been added to your FileBrowser, to these two methods.

maybe this helps, maybe this confuses you further...

marco

On Thu, 21 Oct 1999, Yang Chen wrote:

> Hello All,
>
> Thank you all for answering my previous problem.
> I have new one, hope you guys can help as well.
> Thank you once again.
>
> -Yang
>
>
>
> img = Toolkit.getDefaultToolkit().getImage(filename);
>         width = img.getWidth(this);
>         height = img.getHeight(this);
>
> *****
> Incompatible type for method. Explicit cast needed to convert FileBrowser
> to java.awt.image.ImageObserver.
>       width = img.getWidth(this);
>                            ^
>       height = img.getHeight(this);
>                              ^
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to