Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet loaded in a Frame.

 
Barry
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can an image called within an applet get loaded in a frame calling this applet? Pls give examples as well.
 
sachin sharma
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear bary,
in an applet u can use the image to
declare the Image variable as a class variable.
public class FramedImage {
Image img;
then initilise in init() & call.
it in
public void paint(Graphics g)
g.drawImage(img,Xposition,Yposition);
}
after that u create a frame in main method in the same class
public static void main (String args[])
Frame f = new Frame();
f.init();
FramedImage fi = new FramedImage();
}
run it in a appletviewer or as a standalone as you like.
 
Barry
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks very much buddy. problem solved.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic