File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes displaying problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "displaying problem" Watch "displaying problem" New topic
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: 24183
    
  34

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?
 
jQuery in Action, 2nd edition
 
subject: displaying problem
 
Similar Threads
repaint() in loop problem
2D array battleship
How to draw straight line instead of curved line??
problems with displaying..
Someone, everyone, PLEASE HELP ME ON A PROJECT!!