I am writing an Applet that implements ActionListener. I add components(including Buttons) in init(), ActionPerformed() calls another method. There I call removeAll() and add new components. The problem is they dont get displayed. I even tried calling repaint().
Ok this is just a start, the finished applet will be different. I always have been the type to just start coding. </BLOCKQUOTE> I know displayQuiz() is being called. I tried eliminating the call to removeAll() and just adding new components. They dont get added. I even tried: this.add(instructions, "North"); this.add(question, "West"); this.add(answers, "Center"); this.add(submit, "South"); [This message has been edited by Randall Twede (edited February 04, 2001).]
Joined: Jan 02, 2001
Randall, Here's the solution:
I took out your setBackground() and setForeground() calls, to make the example a little smaller. Feel free to put them back in. The pain-in-the-ass Internet Exploder cached the class file somewhere, so all my changes never got reflected correctly. I wasted a lot of time chasing my tail trying to figure out why my changes weren't getting picked up. I ended up using the AppletViewer. The only thing you were missing is a call to validate() after adding your new components. -Peter [This message has been edited by Peter Tran (edited February 04, 2001).]
thanks Peter, I cant get it to run in IE either. I have a post in the Applet forum about that problem. I will look up validate() in the API right now [This message has been edited by Randall Twede (edited February 04, 2001).]