• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

identifier expected errors :(

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic