Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to rivet the column on JTable?

 
Richard Phen
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!!
 
ZhengQi Huang
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try this:
table.getTableHeader().setReorderingAllowed(false);
 
friso dejonge
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Richard Phen
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can see that in javax.swing.table.JTableHeader,
setReorderingAllowed(boolean) is one method of it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic