package dk.itu.mario.engine.util; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; public class UITextArea extends UIItem{ protected String text; protected int width, height; protected Font font; protected ArrayList lines = new ArrayList(); public static boolean showBox = false; public UITextArea(String text, Font font, int x, int y, int width){ this.text = text; this.font = font; this.x = x; this.y = y; this.width = width; } public void next() { } public void prev() { } public void render(Graphics g) { Graphics2D g2 = (Graphics2D)g; g.setFont(font); lines.clear(); Rectangle2D rec = font.getStringBounds(text,g2.getFontRenderContext()); String tempText = new String(); if(rec.getWidth()>width){ for(int i=0;i=width){ lines.add(tempText); tempText = new String(); } } lines.add(tempText); } else{ lines.add(text); } for(int j=0;j