private static java.awt.Rectangle calculateBounds(final List<Integer[]> lines) {
        int xLeft = Integer.MAX_VALUE;
        int xRight = Integer.MIN_VALUE;
        int yTop = Integer.MAX_VALUE;
        int yBot = Integer.MIN_VALUE;
        
        for (Integer[] line : lines) {
            if (line[0] < yTop)
                yTop = line[0];
            
            if (line[0] > yBot)
                yBot = line[0];
            
            if (line[1] < xLeft)
                xLeft = line[1];
            
            if (line[2] > xRight)
                xRight = line[2];
        }
        
        return new java.awt.Rectangle(xLeft, yTop, xRight-xLeft, yBot-yTop);
    }