// NOTE: should be implemented outside of function, and not using a function public virtual bool mouseWithin(MouseInfo e) { if (e.getX() > xPos && e.getX() <= xPos + width && e.getY() > yPos && e.getY() <= yPos + height) { return(true); } else { return(false); } }
public bool mouseWithin(MouseInfo e) { return(topLeftX <= e.getX() && topLeftX + width > e.getX() && topLeftY <= e.getY() && topLeftY + height < e.getY()); }