| Author |
How to implement Sortcuts in JTable?
|
Piyush Patel
Ranch Hand
Joined: Feb 24, 2009
Posts: 127
|
|
hi, all
i searched forums on this topic but not found..
i created JTable that has 8 colums.
i need to implement shortcut such for moving from first colum to last colum by pressing ctrl+(left arrow key) , so that user will be able to see data from first and last column without moving horizontal scroll bar..
please help me..
thanks;-)
|
[My Blog] [ Follow @Twitter] | Innovations never goes out of Style...
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8438
|
|
One way of doing it is by using key bindings
You will need to define your own bindings and when triggered reorder the columns as required.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Piyush Patel
Ranch Hand
Joined: Feb 24, 2009
Posts: 127
|
|
hi, maneesh thanks for reply .
i got your point.
you told about re-ordering columns, why to do so?
can't we make something that moves horizontal scroll bar automatically to last column?
can you help in this?
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8438
|
|
I got the feeling you wanted to display the last column adjacent to the first column. My bad!
Check out JTable#getCellRect() and JComponent#scrollRectToVisible() methods which you can use for programmatic scrolling
|
 |
Piyush Patel
Ranch Hand
Joined: Feb 24, 2009
Posts: 127
|
|
hi , maneesh can you show example that uses
JTable#getCellRect() and JComponent#scrollRectToVisible() methods
.
please help
thanks;-)
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8438
|
|
Unfortunately, we do not hand out ready made code here at the ranch.
Show us what you have got and we will help you point in the right direction.
While posting your code make sure it is sscce code Please do click on the link to find out what sscce means.
|
 |
 |
|
|
subject: How to implement Sortcuts in JTable?
|
|
|