Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

number of buttons double when I reload an applet, why?

Gregory Banks
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet that declares a bunch of JButtons in private static class variables. I initialize these buttons in the init method which I thought was only supposed to be called once when the browser first creates the applet. However, when I go to another page and come back all of the buttons have been doubled. If I go and return again they have been tripled, and so on. The same thing happens if I reload the applet. Only the original buttons maintain their listeners for events. The others are just empty. How do I avoid this without initializing them outside of the init method? Any help would be greatly appreciated. Thanks.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!