/* Basic Drawing Methods */ /** * Draw a point. * @param point the Pnt to draw */ public void draw(Pnt point) { int r = pointRadius; int x = (int)point.coord(0); int y = (int)point.coord(1); g.fillOval(x - r, y - r, r + r, r + r); }
/** * Draw a circle. * @param center the center of the circle * @param radius the circle's radius * @param fillColor; null implies no fill */ public void draw(Pnt center, double radius, Color fillColor) { int x = (int)center.coord(0); int y = (int)center.coord(1); int r = (int)radius; if (fillColor != null) { Color temp = g.getColor(); g.setColor(fillColor); g.fillOval(x - r, y - r, r + r, r + r); g.setColor(temp); } g.drawOval(x - r, y - r, r + r, r + r); }
/** * Draw a circle. * @param center the center of the circle * @param radius the circle's radius * @param fillColor; null implies no fill */ public void draw(Pnt center, double radius, Color fillColor) { int x = (int)center.coord(0); int y = (int)center.coord(1); int r = (int)radius; if (fillColor != null) { Color temp = g.getColor(); g.setColor(fillColor); g.fillOval(x - r, y - r, r + r, r + r); g.setColor(temp); } g.drawOval(x - r, y - r, r + r, r + r); }
/** * Draw a line segment. * @param endA one endpoint * @param endB the other endpoint */ public void draw(Pnt endA, Pnt endB) { g.drawLine((int)endA.coord(0), (int)endA.coord(1), (int)endB.coord(0), (int)endB.coord(1)); }
/* Basic Drawing Methods */ /** * Draw a point. * @param point the Pnt to draw */ public void draw(Pnt point) { int r = pointRadius; int x = (int)point.coord(0); int y = (int)point.coord(1); g.fillOval(x - r, y - r, r + r, r + r); }
/** * Draw a line segment. * @param endA one endpoint * @param endB the other endpoint */ public void draw(Pnt endA, Pnt endB) { g.drawLine((int)endA.coord(0), (int)endA.coord(1), (int)endB.coord(0), (int)endB.coord(1)); }