Instance Varibles Java Help

Instance Variables

The valid flag is used to make si re that all of the sizing variables are set up exactly
once, the first time this Letter is painted. There are several variables cached hereto
keep from having to do lots of computation each time the applet paints-such as, xO,
wO,xsO,wsO, and gap-which are all explained in the following comments. The tile
Point object is used to remember which square on the 15xlS-board this Letter is on. If this variable is null, .then the Letter is not on the board. The x,y pair is used to ex actly locate the Letter.

move( ), remempert ), and recall( )
TIle movc( ) method is used to tell this tile where to draw. The remember( ) method,
however, is more complicated. It can be called with a null, which means that this tile
should “forget” where it was. This indicates that the letter is not in play. Otherwise, it tells which coordinate on the board this letter is occupying. This state is inspected by a call to recall ).

resize( )
The resize( ) method is culled once by the board in order to tell every letter how big to be. Remember, wand h are static, so this affects all Letter instances at once.

hit( )
The bite ) method returns true if the xp,yp pair passed in falls inside the bounds of this Letter.

validate( )
The validate( ) method is used to load the fonts to find out how big the letters are, to
decide where to paint them.”This information is cached in the private variables discussed earlier. The results of these calculations are used next in paint.

validate()
The validate( ) method is used to load the fonts to find out how big the letters are, to
decide where to paint them.This information is cached in the private variables discussed earlier. The results of these calculations are used next in paint().

paint( )
The paint( ) method is called by the board. It passes in an integer, I, which is one of
NORMAL, BRIGHT, or DIM from this class. That is used as an index into the colors
array to select the base color. A sequence of rectangles is filled to create the appearance of a 3-D highlighted and shadowed button. If points is greater than zero, indicating a non blank letter, then the main letter is drawn, and its point value is drawn next to it.

JavaHelpOnline.com

  • Feel free to send us an inquiry, we will reply back in hours.
 

Verification

Posted on September 18, 2014 in Scrabblet A Multiplayer Word Game

Share the Story

About the Author

Back to Top
Share This