import
java.awt.*;
import
javax.swing.*;
import
java.awt.geom.*;
public
class
solve2
extends
JApplet {
public
void
init()
{
setSize(
300
,
300
);
}
public
void
paint(Graphics g)
{
Ellipse2D ed =
new
Ellipse2D.Double(
100
.0d,
100
.0d,
120
.0d,
80
.0d);
Ellipse2D ed1 =
new
Ellipse2D.Double();
ed1.setFrame(
100
.0d,
100
.0d,
80
.0d,
120
.0d);
Graphics2D g1 = (Graphics2D)g;
g1.setColor(Color.red);
g1.draw(ed);
g1.setColor(Color.blue);
g1.draw(ed1);
g1.setColor(Color.black);
g.drawRect(
100
,
100
,
80
,
100
);
g1.setColor(Color.orange);
g.drawRect(
150
,
150
,
10
,
10
);
JOptionPane.showMessageDialog(
this
,
"ellipse 1 contains point 150, 150 "
+ ed.contains(
150
,
150
));
JOptionPane.showMessageDialog(
this
,
"ellipse 1 contains rectangle at"
+
" 150, 150 of width 10 and height 10 "
+ ed.contains(
150
,
150
,
10
,
10
));
JOptionPane.showMessageDialog(
this
,
"ellipse 1 contains rectangle at "
+
" 150, 150 of width 80 and height 100 "
+ ed.contains(
150
,
150
,
80
,
100
));
JOptionPane.showMessageDialog(
this
,
"ellipse 1 intersect rectangle at "
+
" 150, 150 of width 80 and height 100 "
+ ed.intersects(
150
,
150
,
80
,
100
));
}
}