Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image painted partialy

 
Albert Zilberman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic