• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

graphics painted but not visible

 
Sam Iqbal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I have this weired problem on graphics painting. I have subclassed the canvas to draw my "thing". This canvas is placed in a Panel and in an applet. All BorderLayout-s and all added in the center. When I run the project (I use JBuilder7), I get my "thing" 50% of the times fine. The other 50% of the times I get my canvas empty. Then I resize my applet, I get the whole "thing" fine.
Even when my canvas is empty, it gets new data every few seconds, I can trace the code reaches the paint() method in myCanvas, draws everything but nothing is visible. When it is visible the first time, it gets updated with the new data.
This may sound like a simple "validate()" problem but I have tried validate() in every possible place but no use. Then I looked at the stack, who is calling the myCanvas's paint() method, I spotted the difference. Whenever it doesn't work, myCanvas's update method is called from sun.awt.RepaintArea:169 and whenever it works, myCanvas's paint method is called from sun.awt.RepaintArea:177 Apparantly these two lines fall under paint() method of RepaintArea.java and they should call update() and paint() method respectively.
I got version 1.6 of RepaintArea.java somewhere from the web that doesn't match the above said line numbers. I compile my project with jdk 1.4.1_02-b06. I guess my questions are,
1. Do you know how to get the latest (or various versions of) source code of sun.awt.RepaintArea.java ?
2. Do you have any idea why the above would happen?
Thank you all.
 
Noam Weissman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sam,
Yes its sounds familer. I have a similar problem.
Its not 100% solved but I am forcing it to update by:
update(SupportNotAvailPanel.getGraphics());
SupportNotAvailPanel is the pannel that has a few lables and
a button.
I get from time to time problems but it is a lot better.
Regards,
Noam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic