It's not a secret anymore!*
The moose likes Beginning Java and the fly likes identifier expected errors :( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "identifier expected errors :(" Watch "identifier expected errors :(" New topic
Author

identifier expected errors :(

Ujwala Prabhu
Greenhorn

Joined: Jul 24, 2004
Posts: 1
Hi!

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 ]

an absolute newbie...
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
What kind of errors? Compile-time errors? run-time errors? What are the errors? I would like to help you. When you provide that sort of detail we will be able to look into it a little further.


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

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.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: identifier expected errors :(
 
Similar Threads
Display Frame on Center of Screen
arranging display in a panel with grid bags...
how to - multple row selection with JTable
grid layout
Displaying Table