public static void paragraph(double x, double y, double x2, double y2, Deque<String> s) {
        offscreen.setFont(font);
        FontMetrics metrics = offscreen.getFontMetrics();
        double xs = scaleX(x);
        double ys = scaleY(y);
        double xs2 = scaleX(x2);
        double ys2 = scaleY(y2);
        double currentX = xs;
        double currentY = ys;
        int lines = Math.abs((int) ((ys - ys2)/metrics.getHeight()));
        int count = 0;
        int[] lineCount = new int[lines];
        int cur = 0;
        for(String i: s){
            int height = metrics.getHeight();
            int hs = metrics.getDescent();
            int ws = metrics.stringWidth(i + " ");
            if(currentX + ws >= xs2){
                currentX = xs;
                currentY += height;
                cur++;
            }
            if(cur >= lines) {
                count += lineCount[0];
                for(int j = 0; j < lineCount.length - 1; j++){
                    lineCount[j] = lineCount[j+1];
                }
                lineCount[lineCount.length - 1] = 0;
                cur--;
            }
            lineCount[cur]++;
            currentX += ws;
        }
        currentX = xs;
        currentY = ys;
        for (String i: s){
            if(count > 0) count--;
            else{
                int height = metrics.getHeight();
                int hs = metrics.getDescent();
                int ws = metrics.stringWidth(i + " ");
                if(currentX + ws >= xs2){
                    currentX = xs;
                    currentY += height;
                }
                if(currentY >= ys2){
                    currentY = ys;
                }
                offscreen.drawString(i + " ", (float) (currentX), (float) (currentY + hs));
                currentX += ws;
            }

        }   
        draw();
    }