package kku.cs.fgl.gui;
import java.util.Iterator;
import java.util.Vector;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Rectangle;
public class TPanel extends TComponent {
private Vector<TComponent> childs = new Vector<TComponent>();
public TPanel() {
}
public TPanel(float x, float y) {
super(x, y);
}
public TPanel(float x, float y, int width, int height) {
super(x, y, width, height);
}
public Vector getChilds() {
return childs;
}
@Override
public void paint(Graphics g) {
super.paint(g);
if(childs.size()>0){
//GL.glPushMatrix();
Rectangle oldClip = g.getClip();
g.setClip(0,0,getWidth(),getHeight());
for (TComponent v : childs) {
v.render(g);
}
g.setClip(oldClip);
//GL.glPopMatrix();
}
}
public void add(int index, TComponent element) {
childs.add(index, element);
}
public boolean add(TComponent e) {
return childs.add(e);
}
public void clear() {
childs.clear();
}
public TComponent remove(int index) {
return childs.remove(index);
}
public boolean remove(Object o) {
return childs.remove(o);
}
}