- java.lang.Object
-
- java.awt.dnd.DropTargetContext
-
- All Implemented Interfaces:
- Serializable
public class DropTargetContext extends Object implements Serializable
ADropTargetContext
is created whenever the logical cursor associated with a Drag and Drop operation coincides with the visible geometry of aComponent
associated with aDropTarget
. TheDropTargetContext
provides the mechanism for a potential receiver of a drop operation to both provide the end user with the appropriate drag under feedback, but also to effect the subsequent data transfer if appropriate.- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description protected class
DropTargetContext.TransferableProxy
TransferableProxy
is a helper inner class that implementsTransferable
interface and serves as a proxy for anotherTransferable
object which represents data transfer for a particular drag-n-drop operation.
-
Method Summary
Methods Modifier and Type Method and Description protected void
acceptDrag(int dragOperation)
accept the Drag.protected void
acceptDrop(int dropOperation)
called to signal that the drop is acceptable using the specified operation.void
addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp)
Called when associated with theDropTargetContextPeer
.protected Transferable
createTransferableProxy(Transferable t, boolean local)
Creates a TransferableProxy to proxy for the specified Transferable.void
dropComplete(boolean success)
This method signals that the drop is completed and if it was successful or not.Component
getComponent()
This method returns theComponent
associated with thisDropTargetContext
.protected DataFlavor[]
getCurrentDataFlavors()
get the available DataFlavors of theTransferable
operand of this operation.protected List<DataFlavor>
getCurrentDataFlavorsAsList()
This method returns a the currently available DataFlavors of theTransferable
operand as ajava.util.List
.DropTarget
getDropTarget()
This method returns theDropTarget
associated with thisDropTargetContext
.protected int
getTargetActions()
This method returns anint
representing the current actions thisDropTarget
will accept.protected Transferable
getTransferable()
get the Transferable (proxy) operand of this operationprotected boolean
isDataFlavorSupported(DataFlavor df)
This method returns aboolean
indicating if the givenDataFlavor
is supported by thisDropTargetContext
.protected void
rejectDrag()
reject the Drag.protected void
rejectDrop()
called to signal that the drop is unacceptable.void
removeNotify()
Called when disassociated with theDropTargetContextPeer
.protected void
setTargetActions(int actions)
This method sets the current actions acceptable to thisDropTarget
.
-
-
-
Method Detail
-
getDropTarget
public DropTarget getDropTarget()
This method returns theDropTarget
associated with thisDropTargetContext
.- Returns:
- the
DropTarget
associated with thisDropTargetContext
-
getComponent
public Component getComponent()
This method returns theComponent
associated with thisDropTargetContext
.- Returns:
- the Component associated with this Context
-
addNotify
public void addNotify(java.awt.dnd.peer.DropTargetContextPeer dtcp)
Called when associated with theDropTargetContextPeer
.- Parameters:
dtcp
- theDropTargetContextPeer
-
removeNotify
public void removeNotify()
Called when disassociated with theDropTargetContextPeer
.
-
setTargetActions
protected void setTargetActions(int actions)
This method sets the current actions acceptable to thisDropTarget
.- Parameters:
actions
- anint
representing the supported action(s)
-
getTargetActions
protected int getTargetActions()
This method returns anint
representing the current actions thisDropTarget
will accept.- Returns:
- the current actions acceptable to this
DropTarget
-
dropComplete
public void dropComplete(boolean success) throws InvalidDnDOperationException
This method signals that the drop is completed and if it was successful or not.- Parameters:
success
- true for success, false if not- Throws:
InvalidDnDOperationException
- if a drop is not outstanding/extant
-
acceptDrag
protected void acceptDrag(int dragOperation)
accept the Drag.- Parameters:
dragOperation
- the supported action(s)
-
rejectDrag
protected void rejectDrag()
reject the Drag.
-
acceptDrop
protected void acceptDrop(int dropOperation)
called to signal that the drop is acceptable using the specified operation. must be called during DropTargetListener.drop method invocation.- Parameters:
dropOperation
- the supported action(s)
-
rejectDrop
protected void rejectDrop()
called to signal that the drop is unacceptable. must be called during DropTargetListener.drop method invocation.
-
getCurrentDataFlavors
protected DataFlavor[] getCurrentDataFlavors()
get the available DataFlavors of theTransferable
operand of this operation.- Returns:
- a
DataFlavor[]
containing the supportedDataFlavor
s of theTransferable
operand.
-
getCurrentDataFlavorsAsList
protected List<DataFlavor> getCurrentDataFlavorsAsList()
This method returns a the currently available DataFlavors of theTransferable
operand as ajava.util.List
.- Returns:
- the currently available
DataFlavors as a
java.util.List
-
isDataFlavorSupported
protected boolean isDataFlavorSupported(DataFlavor df)
This method returns aboolean
indicating if the givenDataFlavor
is supported by thisDropTargetContext
.- Parameters:
df
- theDataFlavor
- Returns:
- if the
DataFlavor
specified is supported
-
getTransferable
protected Transferable getTransferable() throws InvalidDnDOperationException
get the Transferable (proxy) operand of this operation- Returns:
- the
Transferable
- Throws:
InvalidDnDOperationException
- if a drag is not outstanding/extant
-
createTransferableProxy
protected Transferable createTransferableProxy(Transferable t, boolean local)
Creates a TransferableProxy to proxy for the specified Transferable.- Parameters:
t
- the Transferable to be proxiedlocal
- true if t represents the result of a local drag-n-drop operation.- Returns:
- the new TransferableProxy instance.
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-java/awt/dnd/droptargetcontext.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.