Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calculate button action code

 
Kenny Washington
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im new to Java , I don't know where to place the actionListener and actionEvents for the Calcbutton, any suggestions will be appreciated ?




 
Campbell Ritchie
Marshal
Posts: 52621
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I suggest you get rid of all those = null assignments. They are redundant. Make sure all those references are initialised in your constructor (or a private or final initGUI or similar method called from the constructor). It may be unnecessary to have that many components as fields. Also get rid of commented-out stuff from previous applications. Leaving old code in might make it easier to calculate Fahrenheit, but when you are trying to work out a mortgage, such old code is a potential source of errors.

I suggest you need to learn to write an anonymous class. I have written about them often enough: try here.
 
Campbell Ritchie
Marshal
Posts: 52621
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I keep trying to add code tags to your post, because it would look a lot better, but it doesn't seem to work. I think this thread would bit better on our GUIs forum, so I shall move it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!