Package kku.cs.fgl.gui

Source Code of kku.cs.fgl.gui.TPanel

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);
  }   

}
TOP

Related Classes of kku.cs.fgl.gui.TPanel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.