This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable - Stop Drag/Drop Column Movement  RSS feed

 
Nura Horne
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to stop the columns in my JTable from being dragged by the user into a new order. i.e. currently if I have two columns Date, Message the user could reorganise the table so the column order was Message, Date. I don't want this to be possible. How do I do this?
Also, how do I make the column headers align on the left rather than in the center?
Thanks, A
[This message has been edited by Arun Horne (edited July 26, 2001).]
[This message has been edited by Arun Horne (edited July 26, 2001).]
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can call the setColumnSelectionAllowed() method and set it false. If you can't select the column, you can't move it.
 
Nura Horne
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok found it out... actually the following fragent I have written shows the idea even if not complete:
<CODE>
JTable m_table = new JTable();
m_table.tableHeader.reOrderingAllowed(false);
</CODE>
JTableHeader also includes lots of other properties including allowing column resize etc.
A

[This message has been edited by Arun Horne (edited July 26, 2001).]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!