|
|
|
Re: Unable to dispose TableColumn [message #454833 is a reply to message #454798] |
Fri, 29 April 2005 18:31 |
Emil Crumhorn Messages: 169 Registered: July 2009 |
Senior Member |
|
|
You reverse the order because you have to delete items from the end to the
beginning or your index will be incorrect after you remove the first one.
Think it of it as a train with cars (that's leaning downhill), if you go
from left to right, and remove one in the middle, all the other ones will
stack up to fill up the space of the missing car, but as you keep counting
normally, your next index will now be off by one as there's 1 car missing.
Or: If you removed car 2, and then wanted to remove car 3, going from left
to right, you'd be at car 4 for index 3. Doing it from the back, you don't
have to worry about the cars that stack up as you're already done with those
and the part that your modifying doesn't change.
Maybe not the best analogy, but I hope you get the idea =)
Emil
"Neeraj" <neerajkrishnag@yahoo.com> wrote in message
news:4c64613169fe45fb8cf481c9c1dc30f8$1@www.eclipse.org...
> Thank you, that resolved my problem... But i just want to know how
> reversing the order of the loop works??
> Your code had some errors.... So i am rewriting it for others to get a
> easy answer:
> System.out.println("before dispose" + table.getColumnCount());
> for(int i = table.getColumnCount() -1; i >= 0; i--)
> {
> //tc[i].dispose();
> table.getColumn(i).dispose();
> }
> System.out.println("after dispose " + table.getColumnCount());
>
> Of course thanks again for providing the soln...and thanks from all those
> who faced the same problem.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04217 seconds