Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Copy the text to clipboard with java

124220May 18 2008 — edited Sep 8 2009
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2009
Added on May 18 2008
23 comments
4,282 views