• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in my first GUI class  RSS feed

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i rewrote this code from head first java book . but every time i try to compile it it gives me this exception
java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: Uncompilable source code - simpleFrame is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
at simpleFrame.<clinit>(simpleFrame.java:6)

how can i instantiate simpleFrame class if i shoild make it abstract?
can anyone help me please?

 
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does not override abstract method actionPerformed(java.awt.event.ActionEvent)


There's your clue. Try putting @Override just before the ActionPerformed method definition and see what happens.
 
Knute Snortum
Sheriff
Posts: 4293
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two more things that aren't causing problems, but are bad practice:

  • It's bad form and confusing to name a class that differs from another class only by case. So jfame is a bad name.
  • By convention, all class names start with a capital letter, so simpleFrame and jframe are bad names.
  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!