Drag and Drop with JTable on Mac OS X

前端 未结 1 1097
春和景丽
春和景丽 2020-12-12 05:26

i have a problem with DnD and JTable on macs. If you start the following program and click (fast) around in the table, sometimes selecting something, sometimes do DnD after

相关标签:
1条回答
  • 2020-12-12 05:51

    When dropping a dragged row anywhere else on the table, I (sometimes) get the errors shown below back as far as Mac OS X 10.5.8. The target selection rectangle remains on the screen, and no further drag operations are possible. I'm not sure why, but I suppose a cell is not recognized as a suitable destination for a row.

    2012-10-14 14:14:23.912 java[44061:10b] *** -[NSWindowViewAWT draggingEnded:]:
        unrecognized selector sent to instance 0x1001e7140
    2012-10-14 14:14:23.913 java[44061:10b] *** -[NSWindowViewAWT draggingEnded:]:
        unrecognized selector sent to instance 0x1001e7140
    

    Dropping the dragged row on another application works as expected.

    As an aside, auto-boxing can simplify the initialization code:

    Object[][] data = {
        {"Mary", "Campione", "Snowboarding", 5, false},
        {"Alison", "Huml", "Rowing", 3, true},
        {"Kathy", "Walrath", "Chasing toddlers", 2, false},
        {"Mark", "Andrews", "Speed reading", 20, true},
        {"Angela", "Lih", "Teaching high school", 4, false}
    };
    

    Addendum: This image shows the drag in progress; after triggering the anomaly, the gray rectangle remains immobile when the frame is dragged.

    image

    As a workaround, there is a solution to disable the grey rectangle altogether.

    0 讨论(0)
提交回复
热议问题