The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2000

Advertisement

Advertisement

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(where do i put it???)

Posted by Paul on December 02, 2001 at 12:07 PM

> > 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.

er..
where do i put the name of the background image??




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us