|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.northwestern.at.utils.swing.XDropTarget
edu.northwestern.at.utils.swing.ListDropTargetOnItem
public abstract class ListDropTargetOnItem
An abstract base class for JList drop targets where the targets are the list elements.
This base class is appropriate for use in situations where drops are on elements rather than between them.
As the user moves the mouse over the list, the cell under the mouse is hilighted by outlining it and painting over it with translucent green. Only "valid" target cells are hilighted. The concrete subclass must implement the targetIsValid method to make the decision about which cells are valid targets.
Thanks to the superclass XDropTarget
lists autoscroll during
drags.
Constructor Summary | |
---|---|
ListDropTargetOnItem(javax.swing.JList list,
javax.swing.JScrollPane scrollPane)
Constructs a new list drop target. |
Method Summary | |
---|---|
abstract void |
acceptDrop(int targetIndex,
java.awt.dnd.DropTargetDropEvent dtde)
Accepts a drop on a target. |
void |
dragExit(java.awt.dnd.DropTargetEvent dte)
Handles drag exit events. |
void |
dragOver(java.awt.dnd.DropTargetDragEvent dtde)
Handles drag over events. |
void |
drop(java.awt.dnd.DropTargetDropEvent dtde)
Handles drop events. |
int |
getScrollIncrement(boolean up)
Gets the scroll increment for autoscrolling. |
void |
stopDrag()
Stops a drag. |
abstract boolean |
targetIsValid(int targetIndex,
java.util.List flavors)
Returns true if a target cell is valid. |
Methods inherited from class edu.northwestern.at.utils.swing.XDropTarget |
---|
dragEnter, dropActionChanged, setGhost, stopCurrentTarget |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListDropTargetOnItem(javax.swing.JList list, javax.swing.JScrollPane scrollPane)
list
- The list.scrollPane
- The scroll pane if the list is scrollable,
else null. Method Detail |
---|
public int getScrollIncrement(boolean up)
getScrollIncrement
in class XDropTarget
up
- True if scrolling up, false if scrolling down. public void stopDrag()
stopDrag
in class XDropTarget
public void dragExit(java.awt.dnd.DropTargetEvent dte)
dragExit
in interface java.awt.dnd.DropTargetListener
dragExit
in class XDropTarget
dte
- The event. public void dragOver(java.awt.dnd.DropTargetDragEvent dtde)
dragOver
in interface java.awt.dnd.DropTargetListener
dragOver
in class XDropTarget
dtde
- The event. public void drop(java.awt.dnd.DropTargetDropEvent dtde)
drop
in interface java.awt.dnd.DropTargetListener
drop
in class XDropTarget
dtde
- The event. public abstract boolean targetIsValid(int targetIndex, java.util.List flavors)
targetIndex
- The target cell index.flavors
- A list of the data flavors in the drag source.
public abstract void acceptDrop(int targetIndex, java.awt.dnd.DropTargetDropEvent dtde)
targetIndex
- The target cell index on which the drop occurred.dtde
- The drop target drop event.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |