• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable question

 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I prevent the table columns from being dragged?
Frank
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Frank,
u can do this by using the setReorderingAllowed(false) method of JTableHeader class.
for example

JTable myTable = new JTable(mymodel,myheaders);
JTableHeader head =myTable.getTableHeader();
//// this function will solve your problem
head.setReorderingAllowed(false);
regards
deekasha
 
Frank Hale
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the code!
Frank
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic