protected void paintComponent(Graphics g) {

        int width = this.getWidth();
        int height = this.getHeight();
        int iconWidth = nodeIcon.getIconWidth();
        int iconHeight = nodeIcon.getIconHeight();
        int iconStringSpace = 10;

        g.clearRect(0, 0, width, height);

        FontMetrics fm = g.getFontMetrics();
        int stringHeight = fm.getHeight();
        int stringWidth = fm.stringWidth(text);

        int iconX = (width - iconWidth) / 2;
        int iconY = (height - iconHeight - stringHeight - iconStringSpace) / 2;
        g.drawImage(nodeIcon.getImage(), iconX, iconY, this);

        int stringX = (width - stringWidth) / 2;
        int stringY = iconY + iconHeight + iconStringSpace;
        g.drawString(text, stringX, stringY);

        if (isResizing()) {
            createHotSpotShapes();

            Graphics2D g2 = (Graphics2D) g;

            Color originalColor = g2.getColor();
            g2.setColor(hotColor);
            for (HotSpotArea hotspot : resizeHotSpotAreas) {
                g2.fillRect(hotspot.getArea().x, hotspot.getArea().y, hotspot.getArea().width, hotspot.getArea().height);
            }

            g2.setColor(originalColor);
        }

        if (isConnecting()) {
            Graphics2D g2 = (Graphics2D) g;
            Color originalColor = g2.getColor();
            g2.setColor(Color.red);
            g2.drawRect(connectHotSpotArea.getArea().x, connectHotSpotArea.getArea().y, connectHotSpotArea.getArea().width, connectHotSpotArea.getArea().height);
            g2.setColor(originalColor);
        }

    }