The moose likes Beginning Java and the fly likes Using the drawoval method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Using the drawoval method" Watch "Using the drawoval method" New topic

Using the drawoval method


Joined: Feb 01, 2002
Posts: 4
I am writing a program where you enter in four int variables and than uses those to draw the oval. I'm having a problem passing the int variables into the drawoval method...Please HELP!
If you wish you may email me at:
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
alsjo :
Can you post your code here? Have you tried to compile it ? What error do you get? At what line? Have you looked up the API for details on the drawOval method? How are you capturing the values that are to be the arguments to the drawOval method?

Joined: Feb 01, 2002
Posts: 4
public class OvalApplet extends JApplet
public void init()
String inleft;
String intop;
String inright;
String inbottom;
int x;
int y;
int right;
int bottom;

// Get input from user

// Convert numbers
x = Integer.parseInt( inleft );
y = Integer.parseInt( intop );
right = Integer.parseInt( inright );
bottom = Integer.parseInt( inbottom );

public void paint( Graphics g )
g.drawoval( x, y, right, bottom );
Getting the error for all variables:
java:50: cannot resolve symbol
symbol : variable bottom
Shivaji Marathe
Ranch Hand

Joined: Jan 11, 2002
Posts: 203
Alsjo :
You are declaring the variables in one method ( init() ) and using them in another( Paint() ). Variables declared in one method are available only in that method.
Also how are you getting values in the
String variables that correspond to the X, Y etc?
I am getting the following errors as well for all the four string variables "Variable inbottom may not have been initialized."

Take a look at the example shapesdemo on sun's tutorial site :

Hope this helps

Joined: Feb 01, 2002
Posts: 4
Ok, I declared the variables globally now I'm getting the following error.
cannot resolve symbol
symbol : method drawoval (int,int,int,int)
location: class java.awt.Graphics
g.drawoval(x, y, right, bottom );

Joined: Feb 01, 2002
Posts: 4
HA...I got it...thanks for your help!!!
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please re-register under an appropriate name as shown in the policy. Your display name should have two names separated by a space and not obviously fictitious.
Thanks again and we hope to see you around the ranch!!

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link: http://aspose.com/file-tools
subject: Using the drawoval method
Similar Threads
Mouse Drag Event
How to draw antialiasing graphics if using Java 1.1 compiler?
Finding the color of a pixel
Drawing circles using the coordinate values that are stored in an ArrayList.
How to draw a circle using 2d arrays