/*      Tile.java          Title:                Poetry Box          Author:            Boaz Ashkenazy and Mike Weller          Description:	     Poetry Box for Poetry.java*/import java.awt.*;public class Tile2 extends java.applet.Applet{       Font f = new Font ("Courier", Font.BOLD, 12);    int left;    int top;    String word;    int stringmid;    int fontmid;    //*********************************************************    public Tile2( int xIn, int yIn, String w ) {       	left = xIn;	top = yIn;	word = w;	// keep tiles on fridge	if (left<170) left=170;	if (left>650) left=650;	if (top<50) top=50;	if (top>400) top=400;    }    //*********************************************************    public void paint ( Graphics g ) {	//g.setColor (Color.black);	FontMetrics fm = getFontMetrics(f);	g.fillRect (left,top,fm.stringWidth(word)+6,fm.getHeight()+2);	g.setColor (Color.black);	g.setFont (f);	g.drawString (word,left+3,top+10);    }    //*********************************************************    public void move ( int xPos, int yPos ) {	FontMetrics fm = getFontMetrics(f);	stringmid = (fm.stringWidth(word)+6)/2;	fontmid = (fm.getHeight()+2)/2;	left = xPos-stringmid;	top= yPos-fontmid;		// keep tiles on fridge	if (left<170) left=170;	if (left>650) left=650;	if (top<50) top=50;	if (top>400) top=400;    }//*********************************************************    public boolean isinTile ( int xCheck, int yCheck ) {	FontMetrics fm = getFontMetrics(f);	if (left <= xCheck 	    && left + fm.stringWidth(word)+6 >= xCheck 	    && top <= yCheck 	    && top + fm.getHeight()+2 >= yCheck) {	    return true;	} else  {	    return false;	}         }//*********************************************************} 