本文整理了Java中java.awt.datatransfer.Clipboard.getData()
方法的一些代码示例,展示了Clipboard.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clipboard.getData()
方法的具体详情如下:
包路径:java.awt.datatransfer.Clipboard
类名称:Clipboard
方法名:getData
暂无
代码示例来源:origin: stackoverflow.com
import java.awt.HeadlessException;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
String data = (String) Toolkit.getDefaultToolkit()
.getSystemClipboard().getData(DataFlavor.stringFlavor);
代码示例来源:origin: RipMeApp/ripme
public static String getClipboardString() {
try {
return (String) Toolkit
.getDefaultToolkit()
.getSystemClipboard()
.getData(DataFlavor.stringFlavor);
} catch (IllegalStateException e) {
e.printStackTrace();
logger.error("Caught and recovered from IllegalStateException: " + e.getMessage());
} catch (HeadlessException | IOException | UnsupportedFlavorException e) {
e.printStackTrace();
}
return null;
}
}
代码示例来源:origin: mabe02/lanterna
private void pasteClipboardContent() {
try {
Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
if(systemClipboard != null) {
injectStringAsKeyStrokes((String) systemClipboard.getData(DataFlavor.stringFlavor));
}
}
catch(Exception ignore) {
}
}
代码示例来源:origin: mabe02/lanterna
private void pasteSelectionContent() {
try {
Clipboard systemSelection = Toolkit.getDefaultToolkit().getSystemSelection();
if(systemSelection != null) {
injectStringAsKeyStrokes((String) systemSelection.getData(DataFlavor.stringFlavor));
}
}
catch(Exception ignore) {
}
}
代码示例来源:origin: runelite/runelite
.getDefaultToolkit()
.getSystemClipboard()
.getData(DataFlavor.stringFlavor)
.toString()
.trim();
代码示例来源:origin: runelite/runelite
.getData(DataFlavor.stringFlavor)
.toString();
if (cursor != cursorEnd)
代码示例来源:origin: runelite/runelite
.getDefaultToolkit()
.getSystemClipboard()
.getData(DataFlavor.stringFlavor)
.toString()
.trim();
代码示例来源:origin: nguyenq/tess4j
/**
* Gets an image from Clipboard.
*
* @return image
*/
public static Image getClipboardImage() {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
try {
return (Image) clipboard.getData(DataFlavor.imageFlavor);
} catch (Exception e) {
return null;
}
}
代码示例来源:origin: magefree/mage
private Optional<String> getClipboardStringData() {
try {
return Optional.of((String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor));
} catch (HeadlessException | UnsupportedFlavorException | IOException e) {
//e.printStackTrace();
}
return Optional.empty();
}
代码示例来源:origin: Haehnchen/idea-php-symfony2-plugin
private void initClassName() {
if(this.classInit != null) {
classCompletionPanelWrapper.setClassName(StringUtils.stripStart(this.classInit, "\\"));
return;
}
try {
String data = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
if(data != null && data.length() <= 255 && data.matches("[_A-Za-z0-9\\\\]+")) {
classCompletionPanelWrapper.setClassName(data);
}
} catch (UnsupportedFlavorException | IOException ignored) {
}
}
代码示例来源:origin: JetBrains/jediterm
protected String getClipboardContent(Clipboard clipboard) throws IOException, UnsupportedFlavorException {
try {
return (String) clipboard.getData(DataFlavor.stringFlavor);
} catch (Exception e) {
LOG.info(e);
return null;
}
}
代码示例来源:origin: net.sf.gluebooster.java.booster/gb-essentials
/**
* Gets the content of the clipboard as string
*
* @return text from clipboard
*/
public static String getClipboardString() throws Exception {
String result = (String) Toolkit.getDefaultToolkit()
.getSystemClipboard().getData(DataFlavor.stringFlavor);
return result;
}
代码示例来源:origin: org.brunocvcunha.inutils4j/inutils4j
public static String getFromClipboard() throws HeadlessException, UnsupportedFlavorException,
IOException {
return (String) Toolkit.getDefaultToolkit().getSystemClipboard()
.getData(DataFlavor.stringFlavor);
}
代码示例来源:origin: senbox-org/snap-desktop
/**
* Retrieves text from the system clipboard.
*
* @return string
*/
public static String getClipboardString() throws IOException, UnsupportedFlavorException {
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
if (clipboard != null) {
return (String) clipboard.getData(DataFlavor.stringFlavor);
}
return null;
}
代码示例来源:origin: otros-systems/otroslogviewer
private Optional<String> getStringFromClipboard(Clipboard systemClipboard) {
Optional<String> data;
try {
data = Optional.of((String) systemClipboard.getData(DataFlavor.stringFlavor));
} catch (UnsupportedFlavorException | IOException e1) {
data = Optional.empty();
}
return data;
}
代码示例来源:origin: otros-systems/otroslogviewer
private void pasteClipboard() {
try {
String data = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor);
loggerConfigTextPane.setText(data);
} catch (UnsupportedFlavorException | IOException ignore) {
}
}
代码示例来源:origin: stackoverflow.com
Clipboard sysClip = Toolkit.getDefaultToolkit().getSystemClipboard();
List<File> filesList= (List<File>)sysClip.getData(DataFlavor.javaFileListFlavor);
if(filesList!= null){
Iterator<File> it = filesList.iterator();
while(it.hasNext()){
System.out.println(it.next().getAbsolutePath());
}
}
代码示例来源:origin: stackoverflow.com
final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
if (clipboard.isDataFlavorAvailable(DataFlavor.imageFlavor)) {
final Image screenshot = (Image) clipboard.getData(DataFlavor.imageFlavor);
...
}
代码示例来源:origin: com.googlecode.lanterna/lanterna
private void pasteClipboardContent() {
try {
Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
if(systemClipboard != null) {
injectStringAsKeyStrokes((String) systemClipboard.getData(DataFlavor.stringFlavor));
}
}
catch(Exception ignore) {
}
}
代码示例来源:origin: com.googlecode.lanterna/lanterna
private void pasteSelectionContent() {
try {
Clipboard systemSelection = Toolkit.getDefaultToolkit().getSystemSelection();
if(systemSelection != null) {
injectStringAsKeyStrokes((String) systemSelection.getData(DataFlavor.stringFlavor));
}
}
catch(Exception ignore) {
}
}
内容来源于网络,如有侵权,请联系作者删除!