jclipboardhelper

Helper library for dealing with the System clipboard in Java.

Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.github.fracpete
Идентификатор

Идентификатор

jclipboardhelper
Последняя версия

Последняя версия

0.1.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

jclipboardhelper
Helper library for dealing with the System clipboard in Java.
Ссылка на сайт

Ссылка на сайт

https://github.com/fracpete/jclipboardhelper
Система контроля версий

Система контроля версий

https://github.com/fracpete/jclipboardhelper

Скачать jclipboardhelper

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.fracpete/jclipboardhelper/ -->
<dependency>
    <groupId>com.github.fracpete</groupId>
    <artifactId>jclipboardhelper</artifactId>
    <version>0.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.fracpete/jclipboardhelper/
implementation 'com.github.fracpete:jclipboardhelper:0.1.2'
// https://jarcasting.com/artifacts/com.github.fracpete/jclipboardhelper/
implementation ("com.github.fracpete:jclipboardhelper:0.1.2")
'com.github.fracpete:jclipboardhelper:jar:0.1.2'
<dependency org="com.github.fracpete" name="jclipboardhelper" rev="0.1.2">
  <artifact name="jclipboardhelper" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.fracpete', module='jclipboardhelper', version='0.1.2')
)
libraryDependencies += "com.github.fracpete" % "jclipboardhelper" % "0.1.2"
[com.github.fracpete/jclipboardhelper "0.1.2"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

jclipboardhelper

Helper library for dealing with the sytem's clipboard in Java.

Maven

You can use the following dependency in your pom.xml:

<dependency>
  <groupId>com.github.fracpete</groupId>
  <artifactId>jclipboardhelper</artifactId>
  <version>0.1.2</version>
</dependency>

Supported formats

  • Copy to clipboard

    • java.lang.String
    • java.awt.image.BufferedImage
    • javax.swing.JComponent -- creates images from it
    • javax.swing.JTable -- call the table's copy action
    • java.awt.datatransfer.Transferable -- supply your own implementation
  • Paste from clipboard

    • java.lang.String
    • java.awt.image.BufferedImage
    • java.awt.datatransfer.Transferable -- returns just an Object

Example usage

Example code for copying data to the clipboard:

import java.awt.image.BufferedImage;
import com.github.fracpete.jclipboardhelper.ClipboardHelper;
...
// string
ClipboardHelper.copyToClipboard("Hello World");
// image
BufferedImage img = ...  // from somewhere
ClipboardHelper.copyToClipboard(img);

Example code for obtaining data from the clipboard:

import java.awt.image.BufferedImage;
import com.github.fracpete.jclipboardhelper.ClipboardHelper;
...
// string available?
if (ClipboardHelper.canPasteStringFromClipboard()) {
  String s = ClipboardHelper.pasteStringFromClipboard();
}
// image available?
if (ClipboardHelper.canPasteImageFromClipboard()) {
  BufferedImage img = ClipboardHelper.pasteImageFromClipboard();
}

Example for clearing the clipboard:

import com.github.fracpete.jclipboardhelper.ClipboardHelper;
...
ClipboardHelper.clearClipboard();

Версии библиотеки

Версия
0.1.2
0.1.1
0.1.0