package com.drakulo.games.ais.ui.component;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import com.drakulo.games.ais.ui.twlbridge.RootPane;
import de.matthiasmann.twl.TextArea;
import de.matthiasmann.twl.Widget;
import de.matthiasmann.twl.textarea.HTMLTextAreaModel;
public class MultilineLabel extends UIComponent implements Bindable{
private TextArea textArea;
public MultilineLabel(String label){
HTMLTextAreaModel tam = new HTMLTextAreaModel();
tam.setHtml(label);
textArea = new TextArea(tam);
textArea.setTheme("html");
textArea.setDefaultStyleSheet();
}
@Override
public void bindTo(RootPane pane) {
pane.add(textArea);
}
@Override
public Widget getBindable() {
return textArea;
}
@Override
public void render(Graphics g) throws SlickException {
// Nothing
}
@Override
public void update(Input input) throws SlickException {
// Nothing
}
public void setSize(int width, int height){
super.setWidth(width);
super.setHeight(height);
textArea.setSize(width, height);
}
public void setPosition(int x, int y){
super.setOX(x);
super.setOY(y);
textArea.setPosition(x, y);
}
public void setText(String text){
((HTMLTextAreaModel)textArea.getModel()).setHtml(text);
}
}