Forums Register Login

Object won't be removed

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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.
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 526 times.
Similar Threads
Issue with BoxLayout using Panels
Problem adding JPanels to a box layout
Problems adding two panels
Problem with setLayout
Swings newbee : Changing window components
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:36:10.