This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Image painted partialy" Watch "Image painted partialy" New topic
Author

Image painted partialy

Albert Zilberman
Greenhorn

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)
{
super.paintComponent(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.
Thanks
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Albert,
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...
HTH,
-Nate
[This message has been edited by Nathan Pruett (edited March 21, 2001).]
[This message has been edited by Nathan Pruett (edited March 21, 2001).]


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image painted partialy