Arc2D class in java

java.awt.geom.Arc2D is a class in java programming language. Inside of this class exists 27 public methods and 3 public variable which is access outside the package. Declaration of this class as follows.

public abstract class java.awt.geom.Arc2D 
extends java.awt.geom.RectangularShape 

Public Variable

There is following variables which is defined as public in (java.awt.geom.Arc2D) java class.

OPEN
CHORD
PIE

Lets see an example how to used of those variable.

// Instance variables java.awt.geom.Arc2D class
import java.awt.geom.Arc2D;
class Example
{
	public static void main(String[] args)
	{
		System.out.println(Arc2D.OPEN);
		System.out.println(Arc2D.CHORD);
		System.out.println(Arc2D.PIE);
	}
}
0
1
2

Arc2D public method

There are following useful methods which is define the inside of java.awt.geom.Arc2D class.

MethodDescription
boolean contains(double x, double y) It determines whether or not the specified point is inside the boundary of the arc.
boolean contains(double x, double y, double w, double h) It determines whether or not the interior of the arc entirely contains the specified rectangle.
boolean contains(Rectangle2D r) It determines whether or not the interior of the arc entirely contains the specified rectangle.
boolean containsAngle(double angle) It determines whether or not the specified angle is within the angular extents of the arc.
boolean equals(Object obj) It determines whether or not the specified is equal to this Arc2D.
abstract double getAngleExtent() It returns the angular extent of the arc.
abstract double getAngleStart() It returns the starting angle of the arc.
int getArcType() It returns the arc closure type of the arc: OPEN, CHORD, or PIE.
Rectangle2D getBounds2D() It returns the high-precision framing rectangle of the arc.
Point2D getEndPoint() It returns the ending point of the arc.
PathIterator getPathIterator(AffineTransform at) It returns an iteration object that defines the boundary of the arc.
Point2D getStartPoint() It returns the starting point of the arc.
int hashCode() It returns the hashcode for this .
boolean intersects(double x, double y, double w, double h) It determines whether or not the interior of the arc intersects the interior of the specified rectangle.
protected abstract Rectangle2D makeBounds(double x, double y, double w, double h) It constructs a of the appropriate precision to hold the parameters calculated to be the framing rectangle of this arc.
abstract void setAngleExtent(double angExt) It sets the angular extent of this arc to the specified double value.
void setAngles(double x1, double y1, double x2, double y2) It sets the starting angle and angular extent of this arc using two sets of coordinates.
void setAngles(Point2D p1, Point2D p2) It sets the starting angle and angular extent of this arc using two points.
abstract void setAngleStart(double angSt) It sets the starting angle of this arc to the specified double value.
void setAngleStart(Point2D p) It sets the starting angle of this arc to the angle that the specified point defines relative to the center of this arc.
void setArc(Arc2D a) It sets this arc to be the same as the specified arc.
abstract void setArc(double x, double y, double w, double h, double angSt, double angExt, int closure) It sets the location, size, angular extents, and closure type of this arc to the specified double values.
void setArc(Point2D loc, Dimension2D size, double angSt, double angExt, int closure) It sets the location, size, angular extents, and closure type of this arc to the specified values.
void setArc(Rectangle2D rect, double angSt, double angExt, int closure) It sets the location, size, angular extents, and closure type of this arc to the specified values.
void setArcByCenter(double x, double y, double radius, double angSt, double angExt, int closure) It sets the position, bounds, angular extents, and closure type of this arc to the specified values.
void setArcByTangent(Point2D p1, Point2D p2, Point2D p3, double radius) It sets the position, bounds, and angular extents of this arc to the specified value.
void setArcType(int type) It sets the closure type of this arc to the specified value: OPEN, CHORD, or PIE.
void setFrame(double x, double y, double w, double h) It sets the location and size of the framing rectangle of this to the specified rectangular values.

This reference is belong to javadoc

Inside of this class exists two inner class.


import java.awt.geom.Arc2D;
public class Example 
{
    public static void main(String[] args) {
        
        // Create instance of inner class
        // Arc2D.Float, and Arc2D.Double class
        // Parameter can be
        // Arc2D.OPEN, Arc2D.CHORD, Arc2D.PIE.
        Arc2D.Float  f = new Arc2D.Float(Arc2D.PIE);
        Arc2D.Double d = new Arc2D.Double(Arc2D.CHORD);
    }
}
Instance of java.awt.geom.Arc2D inner class in java

Method example are coming soon.



Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved