Any idea why isnt update(Graphics g) invoked upon repaint() in updateLocation?? The device is HP IPAQ, Jeode VM, PersonalJava 1.2 Thanks. Below is the code for the class that draws the image. Somehow the printlns never produced checkpoint 2.1 when repaint() is called.
public void updateLocation(VTourLocation vtourLocation, Dimension dim){
this.vtourLocation = vtourLocation;
this.locX = vtourLocation.getX();
this.locY = vtourLocation.getY();
if(!startFlag || vtourLocation.isNewContext()){
byte[] map = vtourLocation.getImage();
currentImg = Toolkit.getDefaultToolkit().createImage(map);
try{
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(currentImg,1);
tracker.waitForID(1);
}
catch(InterruptedException e){
System.out.println(e);
}
catch(NullPointerException nullE){
System.out.println("Something is wrong");
System.exit(1);
}
fitToScreen(dim);
System.out.println("checkpoint 1");
initBufferGraphics();
startFlag = true;
System.out.println("checkpoint 2");
}
repaint();
}
public void update(Graphics g){
paint(g);
}
public void paint(Graphics g){
System.out.println("checkpoint 2.1");
bufferGraphics.setColor(this.getBackground());
bufferGraphics.fillRect(0, 0, bufferImgWidth, bufferImgHeight);
bufferGraphics.drawImage(currentImg,0,0, scaledImgWidth, scaledImgHeight, this);
System.out.println("checkpoint 2.2");
if(startFlag){
System.out.println("checkpoint 3");
bufferGraphics.setColor(Color.green);
bufferGraphics.fillRect(scaledLocX, scaledLocY, scaledRectSize,
scaledRectSize);
}
g.drawImage(bufferImg,0,0,this);
}