Java Swing Tutorial - Java Shape.getBounds()


Shape.getBounds() has the following syntax.

Rectangle getBounds()


In the following code shows how to use Shape.getBounds() method.

import java.awt.Shape;
import java.awt.geom.Rectangle2D;
/* ww  w .j a v  a2s  .  c o m*/
public class Main {
  public static void main(String[] args) throws Exception {
    Shape s = new Rectangle2D.Double(0, 0, 72, 72);


The code above generates the following result.