Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

argument to getHeight()

The definition in Image is

public abstract int getHeight(ImageObserver observer);

If I use this method in an Applet, the argument is this, such as theImage.getHeight(this);

The is no argument mismatch error, although an Applet is sent down to bind to an ImageObserver object. How does that transformation occur?
0
HanRui
Asked:
HanRui
  • 2
  • 2
  • 2
  • +1
1 Solution
 
objectsCommented:
From the javadoc for Applet:

All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

0
 
msterjevCommented:
java.lang.Object
   |
   +---java.awt.Component

public abstract class Component
extends Object
implements ImageObserver, MenuContainer, Serializable

java.lang.Object
   |
   +---java.awt.Component
           |
           +---java.awt.Container
                   |
                   +---java.awt.Panel
                           |
                           +---java.applet.Applet

As you can see Applet extends Component which implements ImageObserver!
0
 
HanRuiAuthor Commented:
I still need help to understand how the "this" is passed down to (ImageObserver observer). I have not seen the declaration of an interface.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
heyhey_Commented:
1. this -> object of class Applet (the applet)
2. Applet class implements ImageObserver interface

||
\/

this (the applet) implements ImageObserver interface
0
 
objectsCommented:
Strike 2 :-(
0
 
heyhey_Commented:
s..t happens ...
0
 
HanRuiAuthor Commented:
Still not helpful to me. I don't understand how an interface becomes an object in the argument list declaration.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now