File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes How to rivet the column on JTable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "How to rivet the column on JTable?" Watch "How to rivet the column on JTable?" New topic
Author

How to rivet the column on JTable?

Richard Phen
Ranch Hand

Joined: Apr 27, 2002
Posts: 52
I have overrided the method isCellEditable(), and return false. Now, the users can not modify the data on JTable anymore, however, they can move the column on JTable. How can I rivet the column on JTable? In other words, how to prevent the users to move the column on JTable?
Thank you!!!


SCJP<br />SCJD
ZhengQi Huang
Greenhorn

Joined: Aug 13, 2002
Posts: 9
You can try this:
table.getTableHeader().setReorderingAllowed(false);


I am a beginner.
friso dejonge
Ranch Hand

Joined: Jul 11, 2002
Posts: 162
hi richard,
further, the java tutorial does give a great example on the jtable, the model and loads of ways of changing it.
regards,
friso


swimming certificate (A & B), shoelaces diploma, and some useless java ones.
Richard Phen
Ranch Hand

Joined: Apr 27, 2002
Posts: 52
Thank you Huang! I fixed it with your suggestion.
One more question: I did not find out this method-setReorderingAllowed(boolean) from jdk1.3 api documents. Would you tell me where is this method defined?
ZhengQi Huang
Greenhorn

Joined: Aug 13, 2002
Posts: 9
You can see that in javax.swing.table.JTableHeader,
setReorderingAllowed(boolean) is one method of it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to rivet the column on JTable?
 
Similar Threads
JTable
JTable
jtable
JTable
JTable