Arranging JTable columns from right to left

When I add columns to JTable, By default, they're arranged from left to right. e.g. if I add in this order (Left to right):


I will get:

| col1 | Col2 | Col3 |

But I want this:

| col3 | Col2 | Col1 |

How can I make a JTable that arrange columns from right to left?


setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT) or applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT) will do the trick. Please refer to java doc for further clarifications



Alternatively you can just reverse the arrays for column names array and row data arrays.

I did it by setting .setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT) on the JTable.


Need Your Help

Running awk command in remote host fails

linux awk

I am running a shell script to run awk command on a remote host. The awk command runs fine locally, but when run for the remote host fails (the redirected file is empty):

File read time in c increase unexpectedly

performance time fread ssd

I'm currently facing an annoying problem, I have to read a big data file (500 GO) which is stored on a SSD revodrive 350.