简体   繁体   English

Swing:如何从 JTable 中拖动多行?

[英]Swing: how do you drag multiple rows from a JTable?

I have a JTable.我有一个 JTable。 If my selection mode is ListSelectionModel.SINGLE_SELECTION , I can drag data from the table elsewhere and it works fine.如果我的选择模式是ListSelectionModel.SINGLE_SELECTION ,我可以将表格中的数据拖到其他地方并且效果很好。

But if my selection mode is ListSelectionModel.MULTIPLE_INTERVAL_SELECTION , when I go to drag the data, it resets the selection to a single selection.但是如果我的选择模式是ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ,当我 go 拖动数据时,它会将选择重置为单个选择。

How can I drag multiple rows from a JTable?如何从 JTable 中拖动多行?

EDIT编辑

Drag and drop of multiple rows should work by default, with or without setting the selection mode.默认情况下,无论是否设置选择模式,都应该可以拖放多行。 With the caveat that drag is enabled on your JTable.需要注意的是,在 JTable 上启用了拖动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM