@Override
    public void render(Graphics2D g)
    {
        Shape outline;
        
        if (connectedObject instanceof Circle)
        {
            double radius = connectedObject.getRadius();
            double diameter = radius * 2;
            double x = connectedObject.getPosition().getX() - radius;
            double y = connectedObject.getPosition().getY() - radius;
            
            outline = new Ellipse2D.Double(x, y, diameter, diameter);
        }
        else if (connectedObject instanceof Polygon)
        {
            Vector[] points = polygonPoints.get();
            
            Path2D.Double polygon = new Path2D.Double();
            polygon.moveTo(points[points.length - 1].getX(), points[points.length - 1].getY());
            
            for (Vector point : points)
            {
                polygon.lineTo(point.getX(), point.getY());
            }
            
            polygon.transform(AffineTransform.getRotateInstance(connectedObject.getRotationAngle()));
            polygon.transform(AffineTransform.getTranslateInstance(connectedObject.getPosition().getX(), 
                                                                  connectedObject.getPosition().getY()));
            
            outline = polygon;
        }
        else
        {
            // no other stuff supported yet
            return;
        }
        
        if (color != null)
        {
            g.setColor(color);
            g.fill(outline);
        }
        
        if (border != null)
        {
            if (borderWidth == 1.0f)
            {
                g.setColor(border);
                g.draw(outline);
            }
            else
            {
                Stroke oldStroke = g.getStroke();
                double scale = g.getTransform().getScaleX();
                g.setStroke(new BasicStroke((float) (borderWidth / scale)));
                
                g.setColor(border);
                g.draw(outline);
                
                g.setStroke(oldStroke);
            }
        }
    }