#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    london
    Posts
    160
    Rep Power
    14
    I really couln not figure out why this doesn't work (it gets stuck after the first loop):

    try
    {
    int countlen=num_hits.length();
    Image images[]=new Image[countlen];
    String imageSrc;
    String DIR="/public_html/SitePit/Graphics/counter";
    for (int i = 0; i < countlen; i++)
    {
    imageSrc = req.getRealPath(DIR + "/" + num_hits.charAt(i) + "SBWM.GIF");
    images[i] = Toolkit.getDefaultToolkit().getImage(imageSrc);
    }

    ...... the rest of code continues....
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Hello,

    This maybe of some use:

    try {
    Image images[]=new Image[countlen];
    String imageSrc;
    String DIR="/public_html/SitePit/Graphics/counter";

    for (int i = 0; i < num_hits.length; i++) {
    imageSrc = req.getRealPath(DIR + "/" + num_hits.charAt(i) + "SBWM.GIF");
    images[i] = Toolkit.getDefaultToolkit().getImage(imageSrc);
    }

    To get the size of an array you do:

    array.length

    not

    array.length()

    Hope that helps!
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Oops, made a small error in your code!

    Just do this:

    try
    {
    int countlen=num_hits.length;
    Image images[]=new Image[countlen];
    String imageSrc;
    String DIR="/public_html/SitePit/Graphics/counter";
    for (int i = 0; i < countlen; i++)
    {
    imageSrc = req.getRealPath(DIR + "/" + num_hits.charAt(i) + "SBWM.GIF");
    images[i] = Toolkit.getDefaultToolkit().getImage(imageSrc);
    }


IMN logo majestic logo threadwatch logo seochat tools logo