package edu.gatech.cs2335.lemmings.gui; import java.awt.Point; import java.awt.Rectangle; import java.awt.Graphics; /** * Class LLeafComponent: This is the opposite of a container. That is, * there can be no children for this component. * *
* Revision History: * v1.0 (Mar. 13, 2004) - Created the LLeafComponent class ** * @author Vladimir Urazov * @version Version 1.0, Mar. 13, 2004 */ public abstract class LLeafComponent extends LComponent { /** * Creates a new
LLeafComponent instance.
*/
public LLeafComponent() {
super();
}
/**
* Moves the component by the offsets specified by the components of
* the point.
*
* @param offset a Point value
*/
public final void move(Point offset) {
Rectangle r = getBounds();
r.x += offset.x;
r.y += offset.y;
/*
Point p = new Point(getBounds().x, getBounds().y);
p.x += offset.x;
p.y += offset.y;
this.setPosition(p);
*/
}
/**
* Marks the component dirty.
*/
public final void makeDirty() {
setDirty(true);
}
/**
* Calls paint on self and then all the children in z order.
*
* @param g a Graphics value
* @return a boolean value
*/
public final boolean renderAll(Graphics g) {
if (!isShown()) {
//I am invisible. No go.
return false;
}
/*
if (!this.isComponentDirty()) {
//Not dirtty. No need to rerender:
return true;
}
*/
this.setDirty(false);
//Paint self:
if (!this.paint(g)) {
//Could not paint self:
return false;
}
return true;
}
}