Hi folks
I would like to draw an image(GIF or JPEG) on to Frame Windows.I didnot find any method in the java API.
But I did find a method to drawImage in applet.
Know my Idea is draw the required image on the Applet and then add the Applet to the Frame Window.
I thought this will work but to my annoyance it didnot
Help in this regard
Following is the code
import java.awt.*;
import java.applet.*;
//<applet code=demo width=500 height=500></applet>
public class demo extends Applet{
public Image im;
public void init(){
try{
im=getImage(getCodeBase(),"some.gif");
}catch(Exception e){System.out.println(e);}
}
public void start()
{
repaint();
}
public void paint(Graphics g)
{
try{
g.drawImage(im,25,25,this);
}
catch(Exception e){System.out.println(e);}
}
public static void main(String args[])
{
Frame f=new Frame();
Applet app =new demo();
app.init();
app.start();
f.add(app);
f.setSize(500,500);
f.setVisible(true);
}
}
Thank u in advance