Results 1 to 2 of 2
  1. #1
    balaram is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Default loading image into applet

    import java.awt.*;
    import java.applet.*;
    public class task extends Applet
    {
    private Image img;
    private String imgName;
    public void init()
    {
    img=null;
    }
    public void loadImage()
    {
    try
    {
    img = getImage(getDocumentBase(),
    "ballu123/baluimage.jpg");
    }catch(Excepion e)
    {
    }
    public void paint(Graphics g)
    {
    if(img== null)
    {
    g.drawImage(img,0,0,this);
    loadImage();
    }
    else
    {
    g.drawString("img is missing",20,20);
    }
    }


    it is not showing any errors but the image is not loading into applet.

    thanks

    balaram

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,903
    Rep Power
    25

    Default

    if(img== null)
    Are you sure this is how you want to test?

    Do you get any output in the browser's java console?

Similar Threads

  1. Dynamic image loading in jsp
    By ramakrishna k m in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 10-10-2011, 07:08 AM
  2. error while loading the image from the server
    By testtest in forum CLDC and MIDP
    Replies: 1
    Last Post: 09-23-2008, 06:16 AM
  3. Loading Image from local directory
    By nancyhung in forum Advanced Java
    Replies: 0
    Last Post: 01-29-2008, 04:46 PM
  4. Loading An Image Help Please!
    By shaungoater in forum Java 2D
    Replies: 2
    Last Post: 01-09-2008, 09:14 AM
  5. problems when loading an image in servlet
    By oregon in forum Java Servlet
    Replies: 1
    Last Post: 08-05-2007, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •