First i must confess that i'm an absolute newbie.. an impatient one though i tried the hello world application and applet several times and even before i started java i had a game that i wanted to develop in mind... (so what's new.. right?) well, i bought myself head first java... and then got stuck a bit in it.... and then decided to use examplets from sun's site to jump start my application... looks like i'm out of luck! i'm missing something very basic... dunno how to go about finding out.
any help will be highly appreciated.
i was looking at opening a frame, drawing a table in it, putting an image when the use clicked his mouse on the table and another image if he deselected the cell and i wanted to have a blank cell as the starting option as well as the cell getting back to that on the third click. and i wanted the program to quit if the user closed the window.
this program started out as a basic one which drew an oval in a frame... i changed it to displaying an image which also worked and then feeling brave i added the mouse listener and the vert/horz lines in grid display and then got a bunch of errors..
thank you very much in advance... Ujwala
[ July 24, 2004: Message edited by: Marilyn de Queiroz ]
The major problem with this code is that you've got a lot of executable statements (the first one starts "table.getModel()..." which are at class scope. Executable statements have to be inside of methods, and can't appear at class scope. Statements like this one that are intended to help set up your various member variables belong in the class's constructor.
You need to slow down a little, and take things one step at a time. Don't ever write a hundred lines of code before checking if it compiles. Write one line, make sure it works, then write another, and check that one. That way, if there's a problem, you'll always know it's in the one line you just typed.