List of usage examples for java.awt.geom Ellipse2D contains
public boolean contains(Point2D p)
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(); }