Solved

argument to getHeight()

Posted on 2002-06-14
7
218 Views
Last Modified: 2010-03-31
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
Comment
Question by:HanRui
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7077876
From the javadoc for Applet:

All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

0
 
LVL 3

Expert Comment

by:msterjev
ID: 7077883
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
 

Author Comment

by:HanRui
ID: 7077938
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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 16

Accepted Solution

by:
heyhey_ earned 100 total points
ID: 7077996
1. this -> object of class Applet (the applet)
2. Applet class implements ImageObserver interface

||
\/

this (the applet) implements ImageObserver interface
0
 
LVL 92

Expert Comment

by:objects
ID: 7079560
Strike 2 :-(
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 7083068
s..t happens ...
0
 

Author Comment

by:HanRui
ID: 7083459
Still not helpful to me. I don't understand how an interface becomes an object in the argument list declaration.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question