PDA

View Full Version : [SOLVED] JTable column



raac
October 24th, 2011, 04:21 PM
I'm writing a java program and I was wondering if there is a way to restrict the columns of a table to move. I googled it, and I found I way to do it but not in a way that I would like.

The solution I found is when the user tries to drag the column, it will back to the original place once the user release the mouse button. What I want is to not let the user drag the column at all.

Thanks.

11jmb
October 24th, 2011, 04:29 PM
What is the way that you found on Google? You may be able to manhandle it a little bit by going through your columns with the getColumn method and then calling setResizeable for each column

ofnuts
October 24th, 2011, 05:06 PM
I'm writing a java program and I was wondering if there is a way to restrict the columns of a table to move. I googled it, and I found I way to do it but not in a way that I would like.

The solution I found is when the user tries to drag the column, it will back to the original place once the user release the mouse button. What I want is to not let the user drag the column at all.

Thanks.


theTable.getTableHeader().setReorderingAllowed(fal se)

raac
October 24th, 2011, 05:21 PM
Thanks ofnuts, that is what I wanted. The google solution was implementing a listener for mouse drags.

Thanks again.