Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

removeAll()

 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Randall,
Display some of your code here. It will help us figure out why it isn't working.
-Peter
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic