java.awt.datatransfer

Class Clipboard

    • Method Detail

      • setContents

        public void setContents(Transferable contents,
                       ClipboardOwner owner)
        Sets the current contents of the clipboard to the specified transferable object and registers the specified clipboard owner as the owner of the new contents.

        If there is an existing owner different from the argument owner, that owner is notified that it no longer holds ownership of the clipboard contents via an invocation of ClipboardOwner.lostOwnership() on that owner. An implementation of setContents() is free not to invoke lostOwnership() directly from this method. For example, lostOwnership() may be invoked later on a different thread. The same applies to FlavorListeners registered on this clipboard.

        The method throws IllegalStateException if the clipboard is currently unavailable. For example, on some platforms, the system clipboard is unavailable while it is accessed by another application.

        Parameters:
        contents - the transferable object representing the clipboard content
        owner - the object which owns the clipboard content
        Throws:
        IllegalStateException - if the clipboard is currently unavailable
        See Also:
        Toolkit.getSystemClipboard()
      • getContents

        public Transferable getContents(Object requestor)
        Returns a transferable object representing the current contents of the clipboard. If the clipboard currently has no contents, it returns null. The parameter Object requestor is not currently used. The method throws IllegalStateException if the clipboard is currently unavailable. For example, on some platforms, the system clipboard is unavailable while it is accessed by another application.
        Parameters:
        requestor - the object requesting the clip data (not used)
        Returns:
        the current transferable object on the clipboard
        Throws:
        IllegalStateException - if the clipboard is currently unavailable
        See Also:
        Toolkit.getSystemClipboard()
      • getAvailableDataFlavors

        public DataFlavor[] getAvailableDataFlavors()
        Returns an array of DataFlavors in which the current contents of this clipboard can be provided. If there are no DataFlavors available, this method returns a zero-length array.
        Returns:
        an array of DataFlavors in which the current contents of this clipboard can be provided
        Throws:
        IllegalStateException - if this clipboard is currently unavailable
        Since:
        1.5
      • isDataFlavorAvailable

        public boolean isDataFlavorAvailable(DataFlavor flavor)
        Returns whether or not the current contents of this clipboard can be provided in the specified DataFlavor.
        Parameters:
        flavor - the requested DataFlavor for the contents
        Returns:
        true if the current contents of this clipboard can be provided in the specified DataFlavor; false otherwise
        Throws:
        NullPointerException - if flavor is null
        IllegalStateException - if this clipboard is currently unavailable
        Since:
        1.5
      • removeFlavorListener

        public void removeFlavorListener(FlavorListener listener)
        Removes the specified FlavorListener so that it no longer receives FlavorEvents from this Clipboard. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this Clipboard. If listener is null, no exception is thrown and no action is performed.
        Parameters:
        listener - the listener to be removed
        Since:
        1.5
        See Also:
        addFlavorListener(java.awt.datatransfer.FlavorListener), getFlavorListeners(), FlavorListener, FlavorEvent

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/awt/datatransfer/Clipboard.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, Clipboard

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut