need help with draw function 
	 
	
		| Author | 
		Message | 
	 
		 
		mapleleafs
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jul 27, 2004 2:17 pm    Post subject: need help with draw function  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				this applet is supposed to receive 4 inputs from the user for the x, y, width, and height of an oval and then it's supposed to draw the oval.
 
 
Here's the program
 
	  | code: | 	 		  // Draws an oval designed by user
 
import java.awt.Graphics;
 
import javax.swing.*;
 
public class DrawCircle extends JApplet {
 
        public void init()
 
        {
 
                String xInput,
 
                           yInput,
 
                           widthInput,
 
                           heightInput;
 
                
 
                int xValue,
 
                        yValue,
 
                        widthValue,
 
                        heightValue;
 
                
 
                xInput =
 
                        JOptionPane.showInputDialog(
 
                                "Enter x coordinate of oval" );
 
                yInput =
 
                        JOptionPane.showInputDialog(
 
                                "Enter y coordinate of oval" );
 
                widthInput =
 
                        JOptionPane.showInputDialog(
 
                                "Enter desired width of oval" );
 
                heightInput =
 
                        JOptionPane.showInputDialog(
 
                                "Enter desired height of oval" );
 
                
 
                xValue = Integer.parseInt( xInput );
 
                yValue = Integer.parseInt( yInput );
 
                widthValue = Integer.parseInt( widthInput );
 
                heightValue = Integer.parseInt( heightInput );
 
        } // end init()
 
        
 
        public void paint ( Graphics g )
 
        {
 
                g.drawOval( xValue, yValue,
 
                                                         widthValue, heightValue );
 
        } // end paint
 
} // end class DrawCircle  | 	  
 
 
the problem is when i try to compile the program it says "cannot resolve symbol variable" for xValue, yValue, widthValue, and heightValue | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		rizzix
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jul 27, 2004 4:43 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| its all because of scope.. u need to declare those variables outside the method init(). that way it is visible to all methods in that class | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |