| Author |
Column Click
|
Arun Sanker
Ranch Hand
Joined: Mar 21, 2007
Posts: 44
|
|
Hi Guys, I have rendered a Jtable with ComboBoxes as shown in figure.The first column is a header column. http://www.upload-images.net/imagen/f59f56f659.jpg When the user selects the first column(ie: with 0 index & no Comboboxes ),I want to know that. How will I know that the user has clicked on the first column Thanks
|
 |
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
|
|
You can add a ListSelectionListener to the columnModels selectionModel table.getColumnModel().getSelectionModel().addListSelectionListener() and listen for changes in the selection. You can use table.setColumnSelectionAllowed() to help isolate the selection. Or you can add a MouseListener/MouseAdapter to the table and in mousePressed look for the column index zero with table.columnAtPoint(e.getPoint()). The tricky part is that if you allow the user to drag the columns around this will give the view column index. You can get the correct column model index from the TabelColumnModel.
|
 |
 |
|
|
subject: Column Click
|
|
|