number of buttons double when I reload an applet, why?
posted 15 years ago
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