本文整理汇总了Java中java.awt.datatransfer.FlavorListener.flavorsChanged方法的典型用法代码示例。如果您正苦于以下问题:Java FlavorListener.flavorsChanged方法的具体用法?Java FlavorListener.flavorsChanged怎么用?Java FlavorListener.flavorsChanged使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.datatransfer.FlavorListener
的用法示例。
在下文中一共展示了FlavorListener.flavorsChanged方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkChange
import java.awt.datatransfer.FlavorListener; //导入方法依赖的package包/类
/**
* Checks change of the {@code DataFlavor}s and, if necessary,
* posts notifications on {@code FlavorEvent}s to the
* AppContexts' EDTs.
* The parameter {@code formats} is null iff we have just
* failed to get formats available on the clipboard.
*
* @param formats data formats that have just been retrieved from
* this clipboard
*/
protected final void checkChange(final long[] formats) {
if (Arrays.equals(formats, currentFormats)) {
// we've been able to successfully get available on the clipboard
// DataFlavors this and previous time and they are coincident;
// don't notify
return;
}
currentFormats = formats;
for (final AppContext appContext : AppContext.getAppContexts()) {
if (appContext == null || appContext.isDisposed()) {
continue;
}
Set<FlavorListener> flavorListeners = getFlavorListeners(appContext);
if (flavorListeners != null) {
for (FlavorListener listener : flavorListeners) {
if (listener != null) {
PeerEvent peerEvent = new PeerEvent(this,
() -> listener.flavorsChanged(new FlavorEvent(SunClipboard.this)),
PeerEvent.PRIORITY_EVENT);
SunToolkit.postEvent(appContext, peerEvent);
}
}
}
}
}
示例2: fireChange
import java.awt.datatransfer.FlavorListener; //导入方法依赖的package包/类
final void fireChange() {
Boolean prev = FIRING.get();
try {
FIRING.set(true);
FlavorEvent e = new FlavorEvent(this);
fireClipboardChange();
for (FlavorListener l : super.getFlavorListeners()) {
l.flavorsChanged(e);
}
} finally {
FIRING.set(prev);
}
}
示例3: setContents
import java.awt.datatransfer.FlavorListener; //导入方法依赖的package包/类
@Override
public void setContents (Transferable t, ClipboardOwner o) {
super.setContents (t, o);
fireClipboardChange ();
FlavorEvent ev = new FlavorEvent(this);
for (FlavorListener flavorListener : getFlavorListeners()) {
flavorListener.flavorsChanged(ev);
}
}