public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        Insets insets = getBorderInsets(c);
        Graphics2D g2 = (Graphics2D) g;
        
        // Get width and height of the images
        int topHeight = getHeight(topImage);
        int leftWidth = getWidth(leftImage);
        int bottomHeight = getHeight(bottomImage);
        int rightWidth = getWidth(rightImage);  
        int topLeftCornerWidth = getWidth(topLeftCornerImage);
        int topLeftCornerHeight = getHeight(topLeftCornerImage);
        int topRightCornerWidth = getWidth(topRightCornerImage);
        int topRightCornerHeight = getHeight(topRightCornerImage);
        int bottomLeftCornerWidth = getWidth(bottomLeftCornerImage);
        int bottomLeftCornerHeight = getHeight(bottomLeftCornerImage);
        int bottomRightCornerWidth = getWidth(bottomRightCornerImage);
        int bottomRightCornerHeight = getHeight(bottomRightCornerImage);
        
        // Add the image border
        if(topImage != null) {
            fillTexture(g2, topImage, x + topLeftCornerWidth, y + insets.top - topHeight, width - topLeftCornerWidth - topRightCornerWidth, topHeight);
        }
        if(leftImage != null) {
            fillTexture(g2, leftImage, x + insets.left - leftWidth, y + topLeftCornerHeight, leftWidth, height - topLeftCornerHeight - bottomLeftCornerHeight);
        }
        if(bottomImage != null) {
            fillTexture(g2, bottomImage, x + bottomLeftCornerWidth, y + height - insets.bottom, width - bottomLeftCornerWidth - bottomRightCornerWidth, bottomHeight);
        }
        if(rightImage != null) {
            fillTexture(g2, rightImage, x + width - insets.right, y + topRightCornerHeight, rightWidth, height - topRightCornerHeight - bottomRightCornerHeight);
        }
        if(topLeftCornerImage != null) {
            fillTexture(g2, topLeftCornerImage, x + Math.max(insets.left, topLeftCornerWidth) - topLeftCornerWidth, y + Math.max(insets.top, topLeftCornerHeight) - topLeftCornerHeight, topLeftCornerWidth, topLeftCornerHeight);
        }
        if(topRightCornerImage != null) {
            fillTexture(g2, topRightCornerImage, x + width - Math.max(insets.right, topRightCornerWidth), y + Math.max(insets.top, topRightCornerHeight) - topRightCornerHeight, topRightCornerWidth, topRightCornerHeight);
        }
        if(bottomLeftCornerImage != null) {
            fillTexture(g2, bottomLeftCornerImage, x + Math.max(insets.left, bottomLeftCornerWidth) - bottomLeftCornerWidth, y + height - Math.max(insets.bottom, bottomLeftCornerHeight), bottomLeftCornerWidth, bottomLeftCornerHeight);
        }
        if(bottomRightCornerImage != null) {
            fillTexture(g2, bottomRightCornerImage, x + width - Math.max(insets.right, bottomRightCornerWidth), y + height - Math.max(insets.bottom, bottomRightCornerHeight), bottomRightCornerWidth, bottomRightCornerHeight);
        }
    }