简体   繁体   English

JTable中的行标题具有与列标题相同的拖放行为

[英]Row header in JTable with same drag/drop behaviour as column header

I'm trying to have row headers in my JTable which have similar behaviour to the column headers, especially for the drag and drop part. 我试图在我的JTable中有行标题,其行为与列标题类似,尤其是对于拖放部分。

Something like this: JTable Row Header Implementation 像这样: JTable行标题实现

And when I drag the row header, it should have the same visual effect as when I drag the column header and the same result (row/column is moved). 而且,当我拖动行标题时,它应具有与拖动列标题时相同的视觉效果 ,并且具有相同的结果(行/列移动)。


So far, one way I thought of is to create my own custom BasicTableHeaderUI and implement the paint() method. 到目前为止,我想到的一种方法是创建自己的自定义BasicTableHeaderUI并实现paint()方法。 Not sure if that will cause problems if other look and feels were used? 不知道如果使用其他外观会不会引起问题?

您可以将D&D侦听器添加到表单元格或整个表,然后将事件传递到处理标头上D&D事件的EventHandler。

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

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