开发者

How can I change JList d'n'd target indicator

I have horizontal JList. When user drags element of this list, there is indicator where draged elem开发者_开发知识库ent would be when it droped. But this indicator is horizontal and appears above or under elements of the list. So how can I change it? I want it to be vertical.

Code creating list:

DefaultListModel model = new DefaultListModel();
// I fill up model with data from DB

list = new JList(model);
list.setName(rs.getString(1));
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

// Next to rows make JList horizontal
list.setLayoutOrientation(JList.VERTICAL_WRAP);
list.setVisibleRowCount(1);

// Add d'n'd
list.setTransferHandler(listHandler);
list.setDragEnabled(true);
list.setDropMode(DropMode.INSERT);


The horizontal line is the usual graphical element if you want to insert a row into a list (or table). I wouldn't change it and stick to the conventions.

If it's vertical - where exactly do you want it? At the beginning of a list entry? But then it wouldn't be clear, if the dropped element would be inserted before or after the 'marked' row.


I asked this question on forum.sources. ru and got solution that works good.

http://forum.sources.ru/index.php?showtopic=304640

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜