import
javafx.geometry.*;
import
java.util.*;
class
Rectangle_1 {
public
static
void
main(String args[])
{
try
{
Rectangle2D rectangle =
new
Rectangle2D(
100
,
100
,
100
,
100
);
display(rectangle);
System.out.println(
"The rectangle contains point 150, 150 = "
+ rectangle.contains(
new
Point2D(
150
,
150
)));
System.out.println(
"The rectangle contains point 50, 50 = "
+ rectangle.contains(
new
Point2D(
50
,
50
)));
System.out.print(
"The rectangle intersects another rectangle "
+
"with width = 100, height = 100, minX = 50, & minY = 50: "
+ rectangle.intersects(
50
,
50
,
100
,
100
));
}
catch
(Exception e)
{
System.err.println(e.getMessage());
}
}
public
static
void
display(Rectangle2D rectangle)
{
System.out.println(
"Upper left point of the rectangle is = "
+ rectangle.getMinX() +
", "
+ rectangle.getMinY());
System.out.println(
"Lower right point of the rectangle is = "
+ rectangle.getMaxX() +
", "
+ rectangle.getMaxY());
System.out.println(
"Width and Height of the rectangle is = "
+ rectangle.getWidth() +
", "
+ rectangle.getHeight());
}
}