This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't evaluate JCheckBox.isSelected() ?  RSS feed

 
Eric Barnhill
Rancher
Posts: 239
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone explain why, for a javax.swing.JCheckBox jcb, the statement



produces the error



Syntax error on ";" , assert expected after this token



The API says isSelected() returns boolean, so I would think this is okay?

Many thanks, Eric

I am compiling in Eclipse and running Java 8.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post 2 lines before and after this one? Most probably the problem lies there
 
Eric Barnhill
Rancher
Posts: 239
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply. The matter is cleared up.

Eclipse has automatic override placeholder text that it places if a new anonymous ActionPerformed is placed within a new anonymous ActionListener. That code threw in an extra bracket, and it was quite hard to spot.

That was why I mentioned Eclipse -- I figured it was messing with me as I have coded plenty of swing!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!