This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hmm, I tried putting your code inside code blocks, but there appears to be something else screwy going on here - maybe your code has tabs in it or something.
Anyway, the carats (^) should point to where the problem lies. In the first line here, they do work:
Bob McDaniel wrote:
The carat is pointing to where it expected to find a variable identifier. You have told it that the action method will accept two parameters, one of which is an Event, and the second of which is an Object. However it does not know what to do with those two objects - it expects to put the event in a variable, and it expects you to give it the variable name (or identifier).
To put it another way, take a look at line 84 in your pasted code above. I have copied it here (although obviously the line number is meaningless out of context):
Here you have specified that the paint method is going to take one parameter, which is a Graphics object and the identifier (name) of the variable to store it in is screen.
I notice that the "arrowheads (^)" have moved. In the original msg the first arrow points to the comma between "Event" and "java" (Event,java), and the second points to the right parenthesis (bracket) (Object)).
author and jackaroo
Thanks, Andrew. You can view the applet working at this URL <http://publish.uwo.ca/~mcdaniel/applets/TptCostArea.html>. After solving I find that I have to collapse then expand the window to see the graph (where I use values <1 for transport rates).
You will note that the labels, e.g. "Transport Rate at A", run over the text box. While one can enter a value into the box, one has to click to the right of the text then use the delete key to erase existing values before entering new ones.
This applet was created several years ago and I don't recall that problem then. Anyway I decided to edit the java file by abbreviating the labels to "Tpt Rate at A". It was when I tried to compile the file using javac in the utility "Terminal" in Mac OS 10.6.6 that the errors at issue arose. I suspect that I'm using a newer version of java now than when I created the original file.
Perhaps this background will help in making a diagnosis.
Joined: Jul 07, 2011
Andrew Monkhouse wrote:Does that mean that you understand the error now?
In principle, yes, but as you see in my previous post the applet ran with no problem in its original incarnation. But if I now have to provide a name for each of Event and Object, where would I put them?
author and jackaroo