java.lang.Objectjava.awt.datatransfer.Clipboard
public class Clipboard
A class that implements a mechanism to transfer data using cut/copy/paste operations.
FlavorListeners may be registered on an instance of the
Clipboard class to be notified about changes to the set of
DataFlavors available on this clipboard (see
addFlavorListener(java.awt.datatransfer.FlavorListener)).
| Field Summary | |
|---|---|
protected Transferable |
contents
|
protected ClipboardOwner |
owner
|
| Constructor Summary | |
|---|---|
Clipboard(String name)
Creates a clipboard object. |
|
| Method Summary | |
|---|---|
void |
addFlavorListener(FlavorListener listener)
Registers the specified FlavorListener to receive
FlavorEvents from this clipboard. |
DataFlavor[] |
getAvailableDataFlavors()
Returns an array of DataFlavors in which the current
contents of this clipboard can be provided. |
Transferable |
getContents(Object requestor)
Returns a transferable object representing the current contents of the clipboard. |
Object |
getData(DataFlavor flavor)
Returns an object representing the current contents of this clipboard in the specified DataFlavor. |
FlavorListener[] |
getFlavorListeners()
Returns an array of all the FlavorListeners currently
registered on this Clipboard. |
String |
getName()
Returns the name of this clipboard object. |
boolean |
isDataFlavorAvailable(DataFlavor flavor)
Returns whether or not the current contents of this clipboard can be provided in the specified DataFlavor. |
void |
removeFlavorListener(FlavorListener listener)
Removes the specified FlavorListener so that it no longer
receives FlavorEvents from this Clipboard. |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ClipboardOwner owner
protected Transferable contents
| Constructor Detail |
|---|
public Clipboard(String name)
Toolkit.getSystemClipboard()| Method Detail |
|---|
public String getName()
Toolkit.getSystemClipboard()public void setContents(Transferable contents, ClipboardOwner owner)
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.
contents - the transferable object representing the
clipboard contentowner - the object which owns the clipboard content
IllegalStateException - if the clipboard is currently unavailableToolkit.getSystemClipboard()public Transferable getContents(Object requestor)
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.
requestor - the object requesting the clip data (not used)
IllegalStateException - if the clipboard is currently unavailableToolkit.getSystemClipboard()public DataFlavor[] getAvailableDataFlavors()
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.
DataFlavors in which the current
contents of this clipboard can be provided
IllegalStateException - if this clipboard is currently unavailablepublic boolean isDataFlavorAvailable(DataFlavor flavor)
DataFlavor.
flavor - the requested DataFlavor for the contents
true if the current contents of this clipboard
can be provided in the specified DataFlavor;
false otherwise
NullPointerException - if flavor is null
IllegalStateException - if this clipboard is currently unavailablepublic Object getData(DataFlavor flavor) throws UnsupportedFlavorException, IOException
DataFlavor.
The class of the object returned is defined by the representation
class of flavor.
flavor - the requested DataFlavor for the contents
DataFlavor
NullPointerException - if flavor is null
IllegalStateException - if this clipboard is currently unavailable
UnsupportedFlavorException - if the requested DataFlavor
is not available
IOException - if the data in the requested DataFlavor
can not be retrievedDataFlavor.getRepresentationClass()public void addFlavorListener(FlavorListener listener)
FlavorListener to receive
FlavorEvents from this clipboard.
If listener is null, no exception
is thrown and no action is performed.
listener - the listener to be addedremoveFlavorListener(java.awt.datatransfer.FlavorListener),
getFlavorListeners(),
FlavorListener,
FlavorEventpublic void removeFlavorListener(FlavorListener listener)
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.
listener - the listener to be removedaddFlavorListener(java.awt.datatransfer.FlavorListener),
getFlavorListeners(),
FlavorListener,
FlavorEventpublic FlavorListener[] getFlavorListeners()
FlavorListeners currently
registered on this Clipboard.
FlavorListeners or an empty
array if no listeners are currently registeredaddFlavorListener(java.awt.datatransfer.FlavorListener),
removeFlavorListener(java.awt.datatransfer.FlavorListener),
FlavorListener,
FlavorEventCes informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
7 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)