Just in case you have discovered your error.  You have an extra close bracket
before the statement your getting the error on.  I've marked it in your code
below with a few ***.  I'd suggest either doing your brackets in such a way
that they line up, or you learn to proofread your code just a little better.


On Tue, 24 Aug 1999, R MUTHUSWAMY wrote:

> 
> hi,
>     i have written a program to display a bulk of images in a one by one
> manner. but in the compilation it is showing a Type Expected error in the
>       if(donecount == tracked)  line.
>  can anybody tell me the reason for the error. i got the same type of
> error in other program earlier which i couldn't solve. And also i heard
> that the same error is coming in the Windows also.
>  Any explanation is appreciated.
>  
> 
> 
> import java.util.*;
> import java.applet.*;
> import java.awt.*;
> 
> public class TrackerImageLoad extends Applet implements Runnable {
> 
>  MediaTracker tracker;
>  int tracked;
>  int frame_rate = 5;
>  int current_img =0;
>  Thread motor;
>  static final int MAXIMAGES = 10;
>  Image img[] = new Image[MAXIMAGES];
>  String name[] = new String[MAXIMAGES];
> 
>  public void init() {
>   tracker = new MediaTracker(this);
>   StringTokenizer st = new StringTokenizer(getParameter("img"), "+");
> 
>   while(st.hasMoreTokens() && tracked <= MAXIMAGES) {
>     name[tracked] = st.nextToken();
>     img[tracked] = getImage(getDocumentBase(), name[tracked]+".jpg");
>     tracker.addImage(img[tracked], tracked);
>     tracked++;
> 
>   }
>  }
> 
>  public void paint(Graphics g) {
>     String loaded = "";
>     int donecount =0;
> 
>     for(int i=0; i<tracked; i++) {
>         if(tracked.checkID(i, true))
>          donecount++;
>          loaded += name[i] +"";
>     }
>  }
   ^ ****** Here is your extra bracket ********
> 
>  Dimension d = getSize();
>  int w = d.width;
>  int h = d.height;
> 
> 
>  if (donecount ==tracked) {
>   frame_rate =1;
>   Image i = img[current_img++];
> 
>  int iw= i.getWidth(null);
>   int ih = i.getHeight(null);
>   g.drawImage(i, (w - iw)/2, (h-ih)/2, null);
>   if(current_img >=tracked)
>     current_img =0;
>   }
>   else {
>    int x = w * donecount / tracked;
>    g.setColor(Color.black);
>    g.fillRect(0, h/3, x, 16);
>    g.setColor(Color.black);
>    g.fillRect(x, h/3, w-x, 16);
>    g.setColor(Color.black);
>    g.drawString(loaded, 10, h/2);
> 
>   }
> 
>  }
> 
>  public void start() {
>   motor = new Thread(this);
>   motor.start();
> 
>  }
> 
>  public void stop() {
>   motor.stop();
>  }
> 
>  public void run() {
>   motor.setPriority(Thread.MIN_PRIORITY);
>   while(true) {
>     repaint();
>     try {
>      Thread.sleep(1000/frame_rate);
> 
>     }
>     catch(InterruptedException e ) {};
>   }
>  }
> }
> 
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 


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

Reply via email to