import java.awt.*; import java.util.*; public class Itm{ ItmInfo info; Point p; public int z; boolean sel; public static final int HIT_LMT = 6; public Vector depdel; public Itm(Point p, int z){ info = null; setPt(p); this.z = z; sel = true; depdel = new Vector(); } public Itm(Point p){ this(p, 0); } public void setPt(Point p){ this.p = p; } public Point pt(){ return p; } public Rectangle rect(){ return Rects.r(pt()); } public void set(ItmInfo info){ this.info = info; } public void setSel(boolean sel){ this.sel = sel; } public double len(Point p){ return Rects.len(p, rect()); } public boolean chkHit(Point p){ return (len(p)<=HIT_LMT); } public Color getCol(){ return sel ? Color.red : Color.yellow; } public void setCol(Graphics g){ g.setColor(getCol()); } public void update(Graphics g){ setCol(g); Rects.fill(g, rect()); } public Dimension cmpSz(){ if(info==null) return null; return info.cmp.size(); } } // EOF