Solved

JTable column problem

Posted on 2004-09-13
3
646 Views
Last Modified: 2008-02-01
My program use JTable to show information in form of table.

Is it possible to disable column swapping feature such that user can only resize the column size, but he/she cannot swapping the columns (eg. swapping column one to column four by drag-and-drop). How to achieve it ?

Thanks.........
0
Comment
Question by:glogin
3 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 50 total points
ID: 12041827
Try:

JTable.getTableHeader().setReorderingAllowed(false);
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12041840
For restricting column movement use
    table.getTableHeader().setReorderingAllowed(false);

For restricting column resizing use
    table.getTableHeader().setResizingAllowed(false);

For individual column resizing use
    table.getColumnModel().getColumn(index).setResizable(false/true);

    NOTE:This does not work (due to a feature) prior to the Java 2 Platform, Standard Editiion, version 1.3 (Kestrel).

0
 
LVL 37

Expert Comment

by:zzynx
ID: 12041843
JTableHeader.setReorderingAllowed(boolean reorderingAllowed)

          Sets whether the user can drag column headers to reorder columns.
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
micro services vs rest web services 16 106
table example 4 29
pagenation logic how it is working in my code 1 31
Adding multiple JVM environments to RedHat 6 7 23
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question