Example usage for java.awt.geom Arc2D contains

List of usage examples for java.awt.geom Arc2D contains

Introduction

In this page you can find the example usage for java.awt.geom Arc2D contains.

Prototype

public boolean contains(Rectangle2D r) 

Source Link

Document

Determines whether or not the interior of the arc entirely contains the specified rectangle.

Usage

From source file:Main.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    int w = getSize().width;
    int h = getSize().height;

    Arc2D arc = new Arc2D.Double(0.0, 0.0, w, h, 0.0, 60.0, Arc2D.CHORD);
    System.out.println(arc.contains(new Rectangle(5, 6, 20, 20)));
    g2.draw(arc);//from w w w  .  ja  v  a  2  s . com

    arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE);

    g2.fill(arc);

    arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN);

    g2.draw(arc);
}