Example usage for java.awt.geom Ellipse2D contains

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

Introduction

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

Prototype

public boolean contains(Point2D p) 

Source Link

Usage

From source file:Main.java

public void drawImage() {
    Graphics2D g = img.createGraphics();
    RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHints(hints);/*from w w  w.  ja v a2  s  .  c  o  m*/

    g.setStroke(new BasicStroke(4));
    for (Ellipse2D shape : shapes) {
        g.setColor(Color.blue);
        g.fill(shape);
        if (shape.contains(mouse)) {
            g.setColor(Color.RED);
        } else {
            g.setColor(Color.YELLOW);
        }
        g.draw(shape);
    }

    l.setIcon(new ImageIcon(img));

    g.dispose();
}