• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Object won't be removed

 
Ranch Hand
Posts: 56
Tomcat Server Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a few fields I'm adding to a JPanel which are called in a method...

When the method is called the following is done :



Which I thought would remove all the previous components added to those JPanels, but subsequent execution of the methods shows the components still apprear in the JTable.

I've also tried re-instantiating the containers but this has no effect.

How can I effectively refresh the containers and remove any components from the containers that were previously added?

This is the code I'm using to add the components to their respective containers.



Any thoughts will be a great help!
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you been through the API documentation for the more basic Swing classes, eg JContainer, JComponent, Component, Container? You will probably find methods allowing you to remove child components, or things like removeAll().

Try Container first.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic