| Author |
displaying problem
|
Savanna Ray
Greenhorn
Joined: Nov 20, 2004
Posts: 9
|
|
Hi, I'm trying to display a 3X3 grid for a tictactoe game, here's the code so far: This program actually compiles, but for some reason it won't display anything when I run the program? Any help would be appreciated. Thanks. Savanna
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24054
|
|
There's nothing here that will ever call "display()". You could override the paint(Graphics) method of Applet and call it there: That will get you started. The next problem you're likely to face is that the dimensions of the board aren't based on those of the applet, so probably you'll only see part of the board. Instead of the sizes being fixed in Board, the Board should get the sizes from the applet, either as constructor arguments, or by being made into a Component itself, added to the applet, which would have its own coordinates.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Savanna Ray
Greenhorn
Joined: Nov 20, 2004
Posts: 9
|
|
Thanks for replying, Ernest! I tried adding the paint method, tictac.display(g), but nothing appeared on the display. The "dos" window shows a 'NullPointerException' at Board.display line 63. Maybe there's a problem in passing the values to the draw method?
|
 |
 |
|
|
subject: displaying problem
|
|
|