File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""Syntax error on token Watch ""Syntax error on token New topic
Author

"Syntax error on token 'list, VariableDeclaratorId expected after this token - Syntax error on

Andrew Sepulveda
Greenhorn

Joined: Oct 02, 2011
Posts: 10


I am unsure of what to do. whenever i add it would get an error "Syntax error on token "list", VariableDeclaratorId expected after this token - Syntax error on". Also I would get another error, "Syntax error on token(s), misplaced construct(s)" Anybody willing to help?

It is suppose to be a simple GUI program as part of a game
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
You have placed the statements in the class body. The below statements should be moved to a method body.
Ove Lindström
Ranch Hand

Joined: Mar 10, 2008
Posts: 326

John Jai wrote:You have placed the statements in the class body. The below statements should be moved to a method body.


Well... you should have a method that are called to build the ui when the constructor is called, that is correct.

But in this case, that is not the error, it is in the order that you have declared things.

Look at this:


You are using the variable pnl before it is declared. that is not possible. You need to create the Panel before you add anything to it. You can't draw on a paper that you don't have.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Ove Lindström wrote:You are using the variable pnl before it is declared. that is not possible. You need to create the Panel before you add anything to it. You can't draw on a paper that you don't have.

Nice catch...
Andrew Sepulveda
Greenhorn

Joined: Oct 02, 2011
Posts: 10
sorry for the late reply, but thanks for the answers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "Syntax error on token 'list, VariableDeclaratorId expected after this token - Syntax error on