@Override
    protected void paintComponent(Graphics g) {
        //System.out.println("Line Paint");
        
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D)g;
        g2d.setColor(getColor());
        
        Stroke temp = g2d.getStroke();
        g2d.setStroke(new BasicStroke(this.getSelect() ? BOLD_SELECT : BOLD_NOSELECT));
        
        int x1,x2,y1,y2;
        x1 = point1.getCenter().x - getLocation().x;
        y1 = point1.getCenter().y - getLocation().y;
        x2 = point2.getCenter().x - getLocation().x;
        y2 = point2.getCenter().y - getLocation().y;
        
        g2d.drawLine(x1, y1, x2, y2);
        
        // DRAW ARROW
        double a, b, c;
        a = x2-x1;
        b = y2-y1;
        a *= 0.8;
        b *= 0.8;
        c = Math.sqrt(a*a + b*b);
        double x3,x4,y3,y4;
        // x3 = x1 + 
        x3  = x1 + a + (Math.min(c*0.1, ARROW_LENGTH)) * (Math.cos(ANGLE_OF_ARROW) * (a / c) + Math.sin(ANGLE_OF_ARROW) * (b / c));
        y3  = y1 + b + (Math.min(c*0.1, ARROW_LENGTH)) * (Math.sin(ANGLE_OF_ARROW) * (b / c) - Math.cos(ANGLE_OF_ARROW) * (a / c));
        g2d.drawLine((int)Math.round(x1 + a), (int)Math.round(y1 + b), (int)Math.round(x3), (int)Math.round(y3));
        x3  = x1 + a + (Math.min(c*0.1, ARROW_LENGTH)) * (Math.cos(ANGLE_OF_ARROW) * (a / c) - Math.sin(ANGLE_OF_ARROW) * (b / c));
        y3  = y1 + b + (Math.min(c*0.1, ARROW_LENGTH)) * (Math.sin(ANGLE_OF_ARROW) * (b / c) + Math.cos(ANGLE_OF_ARROW) * (a / c));
        g2d.drawLine((int)Math.round(x1 + a), (int)Math.round(y1 + b), (int)Math.round(x3), (int)Math.round(y3));
        
        g2d.setStroke(temp);
        
        // print text
        
        g2d.setColor(TEXT_COLOR);
        
        int fontwidth = g2d.getFontMetrics(getFont()).getWidths()[7];
        int weight = ((GraphLine)this.getGraphElement()).getWeight();
        // НЕ ДОЛЖНО БЫТЬ ТАК. ВОЗМОЖНО ПОДУМАТЬ НАД АРХИТЕКТУРОЙ
        
        //System.out.println(fontwidth);
        int stringwidht = ((weight+"").length()) * fontwidth;

        g2d.drawString(weight + "", this.x1+centersdeviation + (this.x2-this.x1  - stringwidht) / 2,
                this.y1+centersdeviation + (this.y2-this.y1) / 2);

        if (!TEST) return;
        
        g2d.setColor(new Color(204, 204, 204));
        g2d.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
        
        g2d.drawLine(
                point1.getCenter().x - getLocation().x - SELECT_RADIUS, 
                point1.getCenter().y - getLocation().y + SELECT_RADIUS, 
                point2.getCenter().x - getLocation().x - SELECT_RADIUS, 
                point2.getCenter().y - getLocation().y + SELECT_RADIUS);
        
        g2d.drawLine(
                point1.getCenter().x - getLocation().x + SELECT_RADIUS, 
                point1.getCenter().y - getLocation().y - SELECT_RADIUS, 
                point2.getCenter().x - getLocation().x + SELECT_RADIUS, 
                point2.getCenter().y - getLocation().y - SELECT_RADIUS);
        
        
    }