public void paintComponent(java.awt.Graphics g) {
super.paintComponent(g);
org.nlogo.api.Graphics2DWrapper g2 = new org.nlogo.api.Graphics2DWrapper((java.awt.Graphics2D) g);
java.awt.Rectangle bounds = getBounds();
List<Element> elements = shape.getElements();
Element element;
// If the shape is rotatable, draw a gray background with a
// black circle in the middle to show the user where to draw
if (editorDialog.isRotatable()) {
g.setColor(java.awt.Color.DARK_GRAY.darker());
g.fillRect(0, 0, bounds.width, bounds.height);
g.setColor(java.awt.Color.BLACK);
g.fillOval(0, 0, bounds.width, bounds.height);
}
gridGapX = (double) bounds.width / VectorShape.NUM_GRID_LINES;
gridGapY = (double) bounds.height / VectorShape.NUM_GRID_LINES;
g.setColor(java.awt.Color.DARK_GRAY.darker());
for (int i = 1; i < VectorShape.NUM_GRID_LINES; ++i) {
g.drawLine(i * Element.round(gridGapX), 0,
i * Element.round(gridGapX), bounds.height);
g.drawLine(0, i * Element.round(gridGapY),
bounds.width, i * Element.round(gridGapY));
}
// Draw crosshairs on top of the grid
g.setColor(java.awt.Color.DARK_GRAY);
g.drawLine(bounds.width / 2, 0, bounds.width / 2, bounds.height);
g.drawLine(0, bounds.height / 2, bounds.width, bounds.width / 2);
g.drawLine(0,
VectorShape.NUM_GRID_LINES * Element.round(gridGapY),
bounds.width,
VectorShape.NUM_GRID_LINES * Element.round(gridGapY));
// Draw the elements
g2.antiAliasing(true);
for (int i = 0; i < elements.size(); ++i) {
element = elements.get(i);
g.setColor(element.getColor());
element.draw(g2, null,
IS_MAC ? 299 : 300,
0);
}
if (tempElement != null) {