Write a java code to draw ovals and circles, JAVA Programming

Assignment Help:

Write a java code to draw Ovals and Circles?

Java has techniques to draw outlined and filled ovals. As you'd probably guess these methods are called drawOval() and fillOval() correspondingly. As you might not guess they take identical arguments to drawRect() and fillRect(), i.e.

public void drawOval(int left, int top, int width, int height)
public void fillOval(int left, int top, int width, int height)

Instead of the dimensions of the oval itself, the dimensions of the smallest rectangle which can enclose the oval are specified. The oval is drawn as large as it can be to touch the rectangle's edges at their centers. This picture might help:

415_rectangle1.png

The arguments to drawOval() are the similar as the arguments to drawRect(). The first int is the left hand side of the enclosing rectangle, the second is the top of the enclosing rectangle, the third is the width and the fourth is the height.

There is no special method to draw a circle. Just draw an oval inside a square.

Java also has methods to draw outlined and filled arcs. They're similar to drawOval() and fillOval() but you must also specify a starting and ending angle for the arc. Angles are given in degrees. The signatures are:public void drawArc(int left, int top, int width, int height,
int startAngle, int stopAngle)
public void fillArc(int left, int top, int width, int height,
int startAngle, int stopAngle)
The rectangle is filled with an arc of the largest circle that could be enclosed within it. The location of 0 degrees and whether the arc is drawn clockwise or counter-clockwise are currently platform dependent.


Related Discussions:- Write a java code to draw ovals and circles

Website for swapping and selling books, Website for swapping/selling books ...

Website for swapping/selling books Project Description: Seeking a website where students can sell and buy books. I want them to swap books as well. Payment options are requir

Program that can read the obj file - wireframe model, We need an OpenGL - b...

We need an OpenGL - based visualisation of an OBJ-File that was created out of Maya3D. (important: we have to use OpenGL with Java - JOGL) In other words: we have an OBJ-file (a

Difference between durable and non-durable subscriptions, Point-To-Point (P...

Point-To-Point (PTP). This model permits exchanging messages via queues formed for some purposes. A client can send and receive messages from one or various queues. PTP model is ea

Want an android app to be build, Want an Android App to be Build What i ...

Want an Android App to be Build What i want is a Taxi App for Android and if good price for iOS too. The App want to have a Website where to add Cars whit all information and

State about the jvm, State about the JVM? JVM is the acronym which ...

State about the JVM? JVM is the acronym which stands for 'Java virtual machine'. JVM provides execution environment. JVM isn't platform independent. JVM is Java

What is scope of variable in java, What is Scope of Variable ? Space in...

What is Scope of Variable ? Space in that a variable is effective is called as the scope of a variable. In other words we can say area where that variable is available for the

What is the purpose of garbage collection in java, What is the purpose of g...

What is the purpose of garbage collection in Java, and when is it used? The purpose of garbage collection is to identify and discard objects that are no longer required by a pr

Make changes to an editable pdf form, Make Changes to an Editable PDF Form ...

Make Changes to an Editable PDF Form Project Description: I need for someone who is able to make some changes to PDF forms. Skills required: Data Processing, Data Entry

Fibonacci, Output first x values in the fibonacci sequence, where x is an a...

Output first x values in the fibonacci sequence, where x is an argument to the program. 0, 1, 1, 2, 3, 5, 8, ... Write the fibonacci creation function separate from the main func

What is meant by semantic error, What is meant by semantic error? Occur...

What is meant by semantic error? Occur while a statement executes and has an effect not intended through the programmer and Frequently times occur only in unusual & infrequent

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd