• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object won't be removed

 
Michael Labuschagne
Ranch Hand
Posts: 56
Java Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • 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!
 
Campbell Ritchie
Marshal
Posts: 52581
119
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!