}
}
}
private void createLine() {
ConstructionStep step = null;
if(tabbedPane.getSelectedComponent() == pOnePoint) {///1 point
try {
Object length, slopeDegrees;
if (rbLengthValue.isSelected())
length = new Double(Double.parseDouble(tfLength.getText()));
else
length = (GeometricalObject)cLengthReference.getSelectedItem();
if (rbSlopeValue.isSelected())
slopeDegrees = new Double(Double.parseDouble(tfSlope.getText()));
else
slopeDegrees = (GeometricalObject)cSlopeReference.getSelectedItem();
Point p = (Point)cPoint.getSelectedItem();
step = new ConstructionStep(this, new Object[]{p, length,
slopeDegrees}, ONE_POINT);
doConstruction(step);
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Please enter numerical value",
"Try Again", JOptionPane.ERROR_MESSAGE);
return;
}
}
if(tabbedPane.getSelectedComponent() == pTwoPoints) {///2 point
Point p1 = (Point)cPoint1.getSelectedItem();
Point p2 = (Point)cPoint2.getSelectedItem();
step = new ConstructionStep(this, new Object[]{p1, p2}, TWO_POINTS);
doConstruction(step);
}
}