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

Need android geolocation service app, Need Android GeoLocation Service App ...

Need Android GeoLocation Service App Project Description: I want an android service app that will run on the background. The app has to get the users location (latitude an

Clean up for java programs, You have recently joined a games company. The S...

You have recently joined a games company. The SQA manager has given you the task of improving the code quality of simple games. This is a standard task which the SQA manager gives

Program implement class which have main string method, Implement the Money ...

Implement the Money class discussed in class. This class should represent a dollar and cents amount with 0-99 cents and the cents being the same sign as the dollars. The class shou

Write names of the dos attacks phases, Write names of the DoS attack's phas...

Write names of the DoS attack's phases? DoS (Denail of service): DoS attach has in total 3 kinds of phases and below they are listed: 1. Search 2. Arm 3. Attack

Program on object oriented technology, This assignment is intended to write...

This assignment is intended to write a simple program in Java and to use the concept of Object Oriented Technology. Open a project named "MyProject" in NetBean. Under this proje

Universal android and ios, Universal Android and iOS, Multipurpose Testing ...

Universal Android and iOS, Multipurpose Testing Application - Based on Phonegap Project Description: Universal Android and iOS, Multipurpose Testing Application Based on Phon

Where the local varible declared, Where the local varible declared? Dec...

Where the local varible declared? Declaring variables within a function, makes them local .They are available only within that function and hold no meaning outside of it

Android App Clone, Hello, My friend Roshan from India told me that you pro...

Hello, My friend Roshan from India told me that you provide a high quality programming service which is why I''m here. I would like you to make a clone of an android app the app

Performance of a java application, How can I improve the performance of a ...

How can I improve the performance of a java application , describe the java optimization techniques?

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