/* * CharNode is a class representing a drawn picture * that is one in a sequence of Pictures to * use for a given character. Don't ever try to traverse this one! **/ public class CharNode extends LLNode { /** * The picture I'm associated with **/ public Picture myPict; /* * Make me with this picture * @param pict the Picture I'm associated with **/ public CharNode(Picture pict){ super(); // Call superclass constructor myPict = pict; } /** * Don't try to remove() from a circular list! **/ public void remove(LLNode node){ System.out.println("Very dangerous to try to remove a node from this list!"); } /** * Don't try to get the last() from a circular list! **/ public LLNode last() { System.out.println("Don't try to find last() from a circular list!"); return this; } /** * Method to return a string with informaiton * about this node */ public String toString() { return "CharNode with picture: "+myPict; } /* * Use the given turtle to draw oneself * @param pen the Turtle to draw with **/ public void drawWith(Turtle pen){ // Assume that we're at the lower-left corner pen.setHeading(0); pen.forward(myPict.getHeight()); Picture bg = pen.getPicture(); myPict.bluescreen(bg,pen.getXPos(),pen.getYPos()); } }