@Override
    public void draw(Graphics2D g2) {
        g2.setStroke(getLineStroke());
        Color oldColour = g2.getColor();
        g2.setColor(getLineColour());

        // Antialiasing
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
        Line2D edge = new Line2D.Double(getConnectionPoints()[0],
                                  getConnectionPoints()[1]);
        g2.draw(edge);
        
        // compute the middle point
        float x = (float) (getConnectionPoints()[0].getX() + getConnectionPoints()[1].getX())/2;
        float y = (float) (getConnectionPoints()[0].getY() + getConnectionPoints()[1].getY())/2;
        Point2D midpoint = new Point2D.Double(x,y);
        
        // draw arrow
        getStartArrow().draw(g2, midpoint,getConnectionPoints()[0], 
                 getLinewidth(), getLineColour());
        
        getEndArrow().draw(g2, midpoint,getConnectionPoints()[1], 
                 getLinewidth(), getLineColour());

        FontMetrics fontMetrics = g2.getFontMetrics();
        // String representation
        String arrows = getArrowString();
        if (!arrows.equals("-")){
            float width = fontMetrics.stringWidth(arrows);
            g2.setColor(getLineColour());
            g2.drawString(arrows,  x - width/2, y - 5.0f - fontMetrics.getHeight());
        }
        
        // draw label
        if(!getLabel().isEmpty()){
            float width = fontMetrics.stringWidth(getLabel());
            g2.setColor(Color.BLACK);
            g2.drawString(getLabel(), x - width/2, y - 5.0f);
        }
        
        g2.setColor(oldColour);
    }