This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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.
 
jQuery in Action, 2nd edition
 
subject: Image painted partialy
 
Similar Threads
Showing Image in JFrame with g.drawImage() - increasing memory usage by switching image
Creating an Image by Plotting Pixels?
How to set icon at net beans
Resize JFrame to fit image
problem in setting background image of jpanel