• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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.
Cheers,
Greg
 
It's just a flesh wound! Or a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic