This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Applets and the fly likes Image painted partialy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Image painted partialy" Watch "Image painted partialy" New topic

Image painted partialy

Albert Zilberman

Joined: Mar 21, 2001
Posts: 6
Hi All!!
I have problem in my Applet application. I need to draw image in some panel. But only half of the image is drawn. This happen only when I use Java Plugin 1.2. In IDE (in my case Visual Age 3.5) and in Java Plug in 1.1.3 it works good.
This is part of code:
public void paintComponent(java.awt.Graphics g)
g.drawImage(img, 0, 0, this);
This method of class wich extends from JPanel.
img - this is an Image, which initialized before the method was called.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Three possible causes ( out of many possible ) :
1. Could the size of the component you are drawing the image to possibly be smaller than the image size?
2. Could your image file possibly be messed up?
3. Try to run your image through MediaTracker before displaying it... MediaTracker ensures that the image is completely loaded before using it. Here is a short intro on how to use MediaTracker ( it is in java.awt ) -

Hope some of these suggestions solve your problem...
[This message has been edited by Nathan Pruett (edited March 21, 2001).]
[This message has been edited by Nathan Pruett (edited March 21, 2001).]

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Image painted partialy
It's not a secret anymore!