This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
background image for the applet/frame
Posted by swapnil on November 16, 2000 at 10:04 AM
> d/inder, pl. find the code to set the background image for the applet/frame. ................................................................ import java.awt.*; import javax.swing.*; import java.applet.*; import java.net.*; /*
*/ public class backgndimg extends JApplet { MediaTracker mt; Image backimg=null; public void init() { setSize(300,300); setVisible(true); Container mycontentpane=getContentPane(); try { backimg=getImage(new URL(getDocumentBase(),getParameter("myimage"))); } catch(Exception e) { System.out.println("swapnil's error :" +e.getMessage()); } } public void paint(Graphics g) { g.drawImage(backimg,0,0,this); g.drawString("hello gurukulonline.com",20,20); } } ................................................................ hope this helps regards, swapnil.
Replies:
|