• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calculate button action code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?




 
Marshal
Posts: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79471
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic