• Post Reply Bookmark Topic Watch Topic
  • New Topic

What am I doing wrong in this swing Java calculator  RSS feed

 
Sam Sha
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




[Edit: put code between [code] and [/code] ubb code blocks]
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12090
246
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error message do you get when you try to compile?
 
Sam Sha
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew Monkhouse wrote:What error message do you get when you try to compile?


I get misplaced constructs for
public void actionPerformed (ActionEvent ae)

and I get
{ to be inserted to complete class body
class SharifCulminating extends JFrame implements ActionListener
{

2 errors. What do i do?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Posts: 12090
246
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange, I've never seen those errors before. I'm guessing that you are using an IDE rather than the command line, and whatever IDE you are using is giving you those messages.

Start by looking at the error where something is needed to complete the class body. Take a look at the source code - do the braces all line up? That is, for every open brace "{" is there a corresponding close brace "}"?
 
Ryan Beckett
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Your attempting to define a method inside a method which is illegal in Java.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!