• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have placed the statements in the class body. The below statements should be moved to a method body.
 
Ranch Hand
Posts: 326
Android Mac OS X Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for the late reply, but thanks for the answers
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic