当前位置: 首页>>代码示例>>Java>>正文


Java FlavorEvent类代码示例

本文整理汇总了Java中java.awt.datatransfer.FlavorEvent的典型用法代码示例。如果您正苦于以下问题:Java FlavorEvent类的具体用法?Java FlavorEvent怎么用?Java FlavorEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FlavorEvent类属于java.awt.datatransfer包,在下文中一共展示了FlavorEvent类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeSureSystemClipboardContainsString

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
private static void makeSureSystemClipboardContainsString(
    Clipboard sys, NbClipboard clip
) throws InterruptedException {
    final CountDownLatch wait = new CountDownLatch(1);
    class FL implements FlavorListener {
        @Override
        public void flavorsChanged(FlavorEvent e) {
            wait.countDown();
        }
    }
    FL fl = new FL();
    sys.addFlavorListener(fl);
    StringSelection ss = new StringSelection("empty");
    clip.setContents(ss, ss);
    wait.await();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NbClipboardTimeoutTest.java

示例2: checkChange

import java.awt.datatransfer.FlavorEvent; //导入依赖的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);
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:SunClipboard.java

示例3: GUIClipboard

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
/** Creates a new instance of GUIClipboard */
public GUIClipboard(GUIPrism pr)
{
    super(pr, false);
    this.prism = pr;
    initComponents();
    doUndoManagerEnables();
    doClipboardEnables();
    
    /* Listen to clipboard events. */
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.addFlavorListener(new FlavorListener() {
    	public void flavorsChanged(FlavorEvent e) {
    		doClipboardEnables();
    	}
    });
}
 
开发者ID:musaeed,项目名称:Prism-gsoc16,代码行数:18,代码来源:GUIClipboard.java

示例4: fireChange

import java.awt.datatransfer.FlavorEvent; //导入依赖的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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:NbClipboard.java

示例5: setContents

import java.awt.datatransfer.FlavorEvent; //导入依赖的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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ExplorerPanelTest.java

示例6: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
public void flavorsChanged(FlavorEvent e)
/*  92:    */     {
/*  93:106 */       JComponent c = TextActions.this.getFocusOwner();
/*  94:107 */       if ((c instanceof JTextComponent)) {
/*  95:108 */         TextActions.this.updateTextActions((JTextComponent)c);
/*  96:    */       }
/*  97:    */     }
 
开发者ID:xiwc,项目名称:confluence.keygen,代码行数:8,代码来源:TextActions.java

示例7: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(final FlavorEvent e) {
	try {
		final Transferable transfer = clipboard.getContents(null);
		final DataFlavor[] transferDataFlavors = transfer.getTransferDataFlavors();
		for (final DataFlavor dataFlavor : transferDataFlavors) {
			if (dataFlavor.equals(DataFlavor.stringFlavor)) {
				this.setEnabled(true);
				return;
			}
		}
	} catch (final Exception e1) {
	}
	this.setEnabled(false);
}
 
开发者ID:nkutsche,项目名称:opendocs,代码行数:16,代码来源:PasteButton.java

示例8: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(FlavorEvent flavorEvent)
{
    System.out.println("Clipboard update detected (Flavor)");

    int[] currentRevision = ClipboardManager.getInstance().getCurrentRevision();
    regainOwnershipAndBroadcast(currentRevision);
}
 
开发者ID:k4v,项目名称:Clipshare,代码行数:9,代码来源:ClipboardListener.java

示例9: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(FlavorEvent e) {
    if( !anyWindowIsActivated )
        return; //#227236 - don't react to system clipboard changes when the IDE window is in the background
    fireChange();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:NbClipboard.java

示例10: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(FlavorEvent ev) {
    schedule();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ExplorerActionsImpl.java

示例11: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(FlavorEvent e) {
  //System.out.println("----------> flavors changed");
  this.clipboardUpdated = true;
}
 
开发者ID:steveonjava,项目名称:widgetfx,代码行数:6,代码来源:ClipboardHandler.java

示例12: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(@Nonnull final FlavorEvent e) {
  processClipboardChange((Clipboard) e.getSource());
}
 
开发者ID:raydac,项目名称:netbeans-mmd-plugin,代码行数:5,代码来源:MMDGraphEditor.java

示例13: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(FlavorEvent e) {
    adjustPasteMenuItem();
}
 
开发者ID:mbraeunlein,项目名称:ExtendedHodoku,代码行数:5,代码来源:MainFrame.java

示例14: flavorsChanged

import java.awt.datatransfer.FlavorEvent; //导入依赖的package包/类
@Override
public void flavorsChanged(FlavorEvent e) {
    if(reactToClipboard)
        PasteAction.this.contextChanged();
}
 
开发者ID:Depter,项目名称:JRLib,代码行数:6,代码来源:PasteAction.java


注:本文中的java.awt.datatransfer.FlavorEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。