Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to view applet

 
Harry Ged
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to java, but i have programmed in C++/C. I was looking for a game of checkers , which is where i found
http://www.cs.caltech.edu/~vhuang/cs20/c/applet/

the problem being , i am unable to view the board completely , i tried both the browsers i had Firefox 1.5/ IE 6, but only a part of board is visible. I read a bit about applets from sun's website ,but i cant seem to find a solution for this. I did try changing the size of the applet (html), but it isnt working.Any suggestions as to what is wrong ? The source for the same is available here
http://www.cs.caltech.edu/~vhuang/cs20/c/applet/checkers.zip

Cheers!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Harry-

Welcome to JavaRanch.

Looking at it in Safari, the display is totally screwed up, with the menus obscuring the field, and a white area in the middle. Using Firefox on OS X, I get a bunch of Exceptions and no display at all. So it's probably not you, it's the applet
 
Harry Ged
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick reply Ulf Dittmer. I guess you ran into a diffrent set of issues , i can start a game , but cant do much. The applet seems to be running , as i could start an entire game Computer vs Computer , the details for which could be seen in the console.Any particular ideas as to why such a fiasco occurs?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The details page says


This code is very old: the game was written in Java 1.0 circa 1997. It is also a very good example of how not to program, because we had to really cut a few corners in order to finish on time. Please do not redistribute or make available modified code. If you do improve the game, please send us a copy, we'd be very interested in it.


and a quick glance at the source code confirms that it is not something that a Java guru would want to tack up on their wall. The most grievous problem I see is that they've built the whole GUI in the applet's constructor, rather than the init() method, as is appropriate. I suspect that if you moved the whole contents of the constructor into init() (right before that "resetBoard()" call) then the GUI woulnd't look so messed up.
 
Harry Ged
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess i ll re-organize and try it out , thanks Ernest
 
Harry Ged
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I moved the contents as you said , re-compled the file , got a few warnings ,but it works like a charm , thanks a million ernest!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic