chinnappan_paul
12 years agoNew Contributor
How to drag a cell from a JTable
Hello, I have a situation where i have to drag an item (probably a cell) from the jtable to another object. I tried different topics in your forum and help pages, but cannot find any solutions (may be I have to research more).
Example: I am searching for a patient in the list(Jtable) and after I find the patient, I have to drag and drop the patient to a bed (jpanel object).
In this above example, I was successful in searching the patient using RowIndex and I was able to get the left and top values of jpanel object (bed). However to perform the drag action, I am not sure how will I drag a cell in the row to the jpanel object.
The question is JGrid.Drag(x1,y1, x2, y2) where x2 and y2 value will be the distance of the jpanel object from the cell of jtable, how will i find the x1, y1 value?
I am attaching the screen of my application. In that, I am trying to drag the guy ' NITIN' to a bed #250. i am not sure how can i accomplish this. The point here is the number of rows in the Jtable increases and does not stay the same. So recorded co-ordinates won't help, with respect to the cell.
Example: I am searching for a patient in the list(Jtable) and after I find the patient, I have to drag and drop the patient to a bed (jpanel object).
In this above example, I was successful in searching the patient using RowIndex and I was able to get the left and top values of jpanel object (bed). However to perform the drag action, I am not sure how will I drag a cell in the row to the jpanel object.
The question is JGrid.Drag(x1,y1, x2, y2) where x2 and y2 value will be the distance of the jpanel object from the cell of jtable, how will i find the x1, y1 value?
I am attaching the screen of my application. In that, I am trying to drag the guy ' NITIN' to a bed #250. i am not sure how can i accomplish this. The point here is the number of rows in the Jtable increases and does not stay the same. So recorded co-ordinates won't help, with respect to the cell.