Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

AWT repaint() in Jeode VM

843807Jun 6 2003 — edited Jun 17 2003
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);								
	}	 	 

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 15 2003
Added on Jun 6 2003
2 comments
80 views