File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Graphics on Applets

 
James Han
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made an Applet, and tried to put graphics on it but when I do the code runs but I have to minimize the applet then make it big again to see the image. This is a Java Project im doing but I am really stuck can someone help me?



Heres the starter

 
Garrett Rowe
Ranch Hand
Posts: 1296
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try inserting

super.paint(g);

as the first method call in your paint() method.
[ May 21, 2006: Message edited by: Garrett Rowe ]
 
James Han
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
super.paint(g); doesnt help
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The

tempG = g;

in your paint method doesn't make any sense. The graphics object is created by AWT when it calls the paint method, and isn't valid anymore outside of the paint method. Later calling paint with tempG in ChangeScreen therefore doesn't do anything useful.

You should never call paint directly. Instead, if you want the component to update its appearance, you should call repaint() instead. That will cause AWT to call your paint method with a valid graphics object.

Moving to the AWT forum, where the experts will correct me...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic