Solved

argument to getHeight()

Posted on 2002-06-14
7
208 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
  • 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xampp tool 12 51
fibonacci ten numbers 4 39
Tomcat: Unable to run tomcat service. 2 20
null output 3 25
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

821 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