The Java Tutorials' Weblog

pageicon Thursday Oct 18, 2007

Showing the Drop Location

Another excerpt from the new dnd lesson.

Generally during a drag operation, a component gives visual feedback when it can accept the data. It might highlight the drop location, or it might show a caret or a horizontal line where the insertion would occur. Swing renders the drop location when the canImport method for the component's TransferHandler returns true.

To control this programmatically, you can use the setShowDropLocation method. Calling this method with true causes the visual feedback for the drop location to always be displayed, even if the drop will not be accepted. Calling this method with false prevents any visual feedback, even if the drop will be accepted. You always invoke this method from canImport.

-- Sharon Zakhour

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
12
14
15
16
18
19
20
21
22
23
26
27
28
29
30
     
       
Today

Feeds

Search this blog

Links

Weblog menu

Today's referrers

Today's Page Hits: 365