Copy the text to clipboard with java
124220May 18 2008 — edited Sep 8 2009Hi all,
Forms Version 10.1.2.0.2
OracleAS Version 10.1.2.0.2
I have written a small java class to copy the text (content of a text item) into the clipboard.
After Import Java Class in Oracle Forms a have under Program units one package copytoclipboard with wrapper procedure copytoclipboard.
My Java Class:
=======================================
public class CopyToClipboard
{
public static void CopyToClipboard(String inTxt)
{
Toolkit tk = Toolkit.getDefaultToolkit();
StringSelection st = new StringSelection(inTxt);
Clipboard cp = tk.getSystemClipboard();
cp.setContents(st, st);
}
//public static void main (String args[])
//{
// CopyToClipboard("qwqwqwqwqwqwqw");
//}
}
=======================================
I've created a Push button with folowing When-Button-Pressed code:
copytoclipboard.copytoclipboard('This is the test');
Then I have edited the default.env and inserted the path to the jar file in CLASSPATH.
When I execute the form and click the button then nothing occures. The text will not be copied to the clipboard.
When I execute the java in jdeveloper, then the text will be copied.
Any ideas?
Pleas Help.
Regards,
Leonid