Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem implememnting ActionListener

 
Robert Sheriff
Greenhorn
Posts: 2
Android Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a mortgage calculator for my Java class, not I am not trying to get anyone to do my homework, NOT AT ALL, however I have hit a road block and need some fresh eyes. I am trying to implement ActionListener into my code but I continue to get compile errors no matter how I change the configuration and my book has proven NO help for this, so I am turning to the knowledge base available here. As the code stands now, I get a compile error saying that a non-static variable this can not be referenced from a static context, so I tried to move the content with the ActionListener out of the main method with no luck, I created a new public method called contenseFrame() and used the aWindow.add(new contenseFrame()); in my main method but then I get an error saying invalid method declaration; return type required... both errors have me stumped and I feel like I need a fresh set of eyes to look at it...

 
Rob Camick
Ranch Hand
Posts: 2475
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your basic structure is all wrong. Get rid of all the static variables and create the components of your panel in the constructor of your panel. Something like:


Read the Swing tutorial for more examples.
 
Robert Sheriff
Greenhorn
Posts: 2
Android Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I see where I made my mistake... Thank you... I redesigned and it opens, but I get an error when I click Calculate..... Looks like I still need to tweak it

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic