>         i want to draw a image in my applet and i used the code 
> below. but it is not loading. i think there is a small mistake.
> 
> public class GetImage extends java.applet.Applet {
> 
>     Image img;
> 
>     public void init() {
> 
>         System.out.println(getCodeBase());
>         try {
>         img = getImage(new
> URL("http://163.122.6.33:2000/applet/"),"Chinese.jpg");
>         System.out.println(img.getSource());
>                 }
>                 catch(Exception e)
>                 {
>                     System.out.println("Exception"+e);
>                 }
> 
>     }

If you mean that it's partially loading, then you probably 
need to use a MediaTracker to make sure the image is
completely loaded before you try to use it.  (I'm not 
sure if you have a different problem exactly)

The code to do this is something like:

  MediaTracker tracker = new MediaTracker(this);
  img = getImage(getDocumentBase(), "Chinese.jpg");
  tracker.addImage(img, 0);
  try {
    tracker.waitForAll();
  } catch (InterruptedException ex) {
    System.err.println("Exception while waiting for image to load");
    ex.printStackTrace();
  }

Hope this helps,

Rick Sanders
[EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to