JOptionPane.showMessageDialog(this, "Please enter positive value for " +
"radius", "Try Again", JOptionPane.ERROR_MESSAGE);
initDialog();
}
}
Circle newCircle = new Circle(centre, radius);
newCircle.addToObjects(objects);
if (radiusReference)
if (obj1 instanceof Line) {
((Line)obj1).addPropertyChangeListener(Line.PROP_LENGTH, newCircle);
newCircle.addPropertyChangeListener(Circle.PROP_RADIUS, (Line)obj1);
}
else {
((Circle)obj1).addPropertyChangeListener(Circle.PROP_RADIUS, newCircle);
newCircle.addPropertyChangeListener(Circle.PROP_RADIUS, (Circle)obj1);
}
clearAndHide();
step.setOutputs(new Object[]{newCircle});
fireUndoableEditUpdate(new UndoableEditEvent(this, step));
}
else if (step.getConstructionType() == THREE_POINTS) {
Point point1 = (Point)step.getInputs()[0];
Point point2 = (Point)step.getInputs()[1];
Point point3 = (Point)step.getInputs()[2];
Line line12 = new Line(point1, point2);
Line line23 = new Line(point2, point3);
if (!((line12.isParallel(line23))||(point1.equalTo(point2))
|| (point2.equalTo(point3)) || (point3.equalTo(point1)))) {
Circle newCircle = new Circle(point1, point2, point3);
newCircle.addToObjects(objects);
clearAndHide();
step.setOutputs(new Object[]{newCircle.getCentre(), newCircle});
fireUndoableEditUpdate(new UndoableEditEvent(this, step));
}
else {
JOptionPane.showMessageDialog(this, "Select three distinct"
+ " non-collinear points", "Try Again", JOptionPane.ERROR_MESSAGE);