This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I want a user to be able to remove a column by tripleclicking on the tableheader. My code below works properly except it throws an Exception the second time the header is clicked. The column is still removed nonetheless, but I would like to avoid the Exception:
Please give more details. It is usually quite easy to work out what ArrayIndexOutOfBoundsException means, but there doesn't seem to be an array in the code snippet you posted.
Please check whether any of the methods you are calling might throw such an Exception (but it would be unusual for it to be declared in a "throws").
Remember that in GUI work you have several threads running simultaneously, and an Exception might stop the thread it occurs in without the whole app terminating. Also, that the fact that your Listener (which is what you have quoted looks like) sets off the Exception doesn't necessarily prove that the Exception occurs there. You can usually find out by looking at the class and line number given on the first line of the stack trace.