java - transferhandler ignores drag event -
i set transfer handler on jtable (embedded in jpanel + jscrollpane). dragging elements table somewhere else (create transferable ...) works. drop elements table doesn't work,any drag event ignored. problem might event consumer (consuming drag event), that's idea have.
final jtable tbl = new myjtable(); tbl.setdragenabled(true); tbl.settransferhandler(new transferhandler() { @override protected transferable createtransferable(jcomponent comp) { // .... works } @override public boolean canimport(transfersupport support) { // ... never called } @override public boolean importdata(transfersupport support) { // ... never called }
i remember having same problem working jtree , solution implementing getsourceactions
in transferhandler
, define transfer action inside it. example:
@override public int getsourceactions(jcomponent comp) { return move; }