public static void drawLabel(double x, double y, String str) { DrawObject L = new DrawObject(); L.color = labelColor; L.x = x; L.y = y; L.str = str; L.sequenceNum = currentSequenceNum; if (animationMode) { synchronized (animLabels) { animLabels.add(L); } } else { synchronized (labels) { labels.add(L); } } drawArea.repaint(); }
public static void drawPoint(double x, double y) { DrawObject p = new DrawObject(); p.color = pointColor; p.x = x; p.y = y; p.diameter = pointDiameter; p.sequenceNum = currentSequenceNum; if (animationMode) { synchronized (animPoints) { animPoints.add(p); } } else { synchronized (points) { points.add(p); } } drawArea.repaint(); }
public static void drawRectangle(double x1, double y1, double width, double height) { DrawObject R = new DrawObject(); R.color = rectangleColor; R.x = x1; R.y = y1; R.width = width; R.height = height; R.sequenceNum = currentSequenceNum; R.drawStroke = drawStroke; if (animationMode) { synchronized (animRectangles) { animRectangles.add(R); } } else { synchronized (rectangles) { rectangles.add(R); } } drawArea.repaint(); }
public static void drawLine(double x1, double y1, double x2, double y2, boolean isArrow) { DrawObject L = new DrawObject(); L.color = lineColor; L.x = x1; L.y = y1; L.x2 = x2; L.y2 = y2; if (isArrow) { L.color = arrowColor; L.isArrow = true; } L.sequenceNum = currentSequenceNum; L.drawStroke = drawStroke; if (animationMode) { synchronized (animLines) { animLines.add(L); } } else { synchronized (lines) { lines.add(L); } } drawArea.repaint(); }