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

I need android kiosk mode, I need Android Kiosk Mode Project Description...

I need Android Kiosk Mode Project Description: I need an Android platform developer to develop an app when device start it start into kiosk mode. Only browser window open a c

Explain final fields, Explain final fields ? You may also declare field...

Explain final fields ? You may also declare fields to be final. This is not the similar thing as declaring a method or class to be final. While a field is declared final, it is

Explain the importance of abstract classes in java, Question: (a) Expl...

Question: (a) Explain the importance of abstract classes in Java with an appropriate example. (b) Explain what is meant by an interface in Java? Use a simple example to il

Describe the edit phase- java program development, Describe the Edit phase-...

Describe the Edit phase- Java Program Development Phase comprises editing a file. This is done with an editor program. Programmer types a java program using editor such as no

Determine the types of object oriented programme, Determine the types of ob...

Determine the types of object oriented programme Classes - Prototypes for objects - Definition or a blueprint of a user-defined datatype - Think of it as a ma

What is my personal agent, What is "My Personal Agent"? My personal age...

What is "My Personal Agent"? My personal agent is a computer programme which work automatically and have voice interface.

Javascript validation, Javascript validation, JAVA Programming 1. Obtaining...

Javascript validation, JAVA Programming 1. Obtaining the new script: Download and save the attached comment CGI mailer script form-mail2.pl to your server''s cgi-bin directory, and

Networking, which concept is used to connect the networking in java

which concept is used to connect the networking in java

Design a system program, System Program Project Description: I want s...

System Program Project Description: I want someone who can study my existing program and from there the updates may be done Skills required: Java, Oracle, MySQL, Softwa

The tic-tac-toe program, Instructions Modify the program so that the co...

Instructions Modify the program so that the computer will generate moves for the ‘O' player (it must continue to accept user input for ‘X'). A simple way to do this is to use a

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