private void drawNode(RBNode node, int curLevel, int leftPos, int rightPos) {
        if (node == null) return;
        // try{Thread.sleep(100);} catch(Exception e) {}
        if (node.getColor() == com.andreydev.rbtree.Color.BLACK) {
            window.setColor(black);
        } else {
            window.setColor(red);
        }
        window.fillOval(((leftPos + rightPos) / 2) - ovalSize / 2, offY + (curLevel * branchLine) - ovalSize / 2, (int) ovalSize, (int) ovalSize);
        window.setColor(white);
        if (node.getKey() != Integer.MAX_VALUE) {
            window.drawString(node.getKey() + "", ((leftPos + rightPos) / 2) - ovalSize / 6, offY + (curLevel * branchLine) + ovalSize / 8);
        } else {
            window.drawString("NIL", ((leftPos + rightPos) / 2) - ovalSize / 4, offY + (curLevel * branchLine) + ovalSize / 8);
        }

        window.setColor(black);
        if (node.getLeft() != null) {
            window.drawLine(((leftPos + rightPos) / 2), offY + ovalSize / 2 + (curLevel * branchLine),
                    ((3 * leftPos + rightPos) / 4), offY + (curLevel * branchLine + branchLine));
            drawNode(node.getLeft(), curLevel + 1, leftPos, (leftPos + rightPos) / 2);
        }
        if (node.getRight() != null) {
            window.drawLine((leftPos + rightPos) / 2, offY + ovalSize / 2 + (curLevel * branchLine),
                    ((3 * rightPos + leftPos) / 4), offY + (curLevel * branchLine + branchLine));
            drawNode(node.getRight(), curLevel + 1, (leftPos + rightPos) / 2, rightPos);
        }
    }