Untitled
By: a guest | Mar 21st, 2010 | Syntax:
Java | Size: 0.44 KB | Hits: 84 | Expires: Never
import java.awt.Rectangle;
public class RectangleCenter
{
public static void main(String[] args)
{
Rectangle box = new Rectangle(75, 75, 50, 50);
double xCoord = box.getCenterX();
double yCoord = box.getCenterY();
double rectangleWidth = box.getWidth();
System.out.println("The center of this rectangle is at: (" + xCoord + ", " + yCoord + ")" + "It's width is: " + rectangleWidth);
}
}