Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 13th, 2006, 02:27 PM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2001
Location: Bonita Springs, FL
Posts: 5,654 kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 2 Months 2 Weeks 2 Days 5 h 1 m 44 sec
Reputation Power: 3436
Interact with System clipboard from applet.

Hi

This may not even be possible, but I'm not sure. I am trying to make an app that will be used to view documents online. It should be possible for people to copy the text from these documents to another program if they want, but I need to be able to control what they copy and append some information to the text (a citation really)

For example, say one were viewing this post and wanted to copy something out of it. The app should allow the copy, but add a citation after it so when pasted into the other program it looks like:

Quote:
"This may not even be possible, but I'm not sure."

Interact with System clipboard from applet. http://forums.devshed.com/... p1 13 Oct 2006



To do that I need to
1) Be able to set the system clipboard, which I can't do from an applet due to security restrictions (works as an app)

2) Intercept ctrl+c to run my own copy function which can create and append the citation text.


Is this possible at all using java, or would I be forced into doing something with activex or something else?

I'm thinking the first point should be possible, though I may need to sign the applet or something, which I don't know how to do and the info I have been able to find online seems to all be outdated or doesn't work anyway.
__________________
Recycle your old CD's, don't just trash them


Spidermonkey Tutorial;

If I helped out out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud

Reply With Quote
  #2  
Old October 14th, 2006, 09:18 PM
occam999 occam999 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 191 occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level)occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level)occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level)occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level)occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level)occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level)occam999 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 11 h 26 m 59 sec
Reputation Power: 81
I'm no expert on Java applet security, but I suspect signing the applet may be the only way around this in pure Java.

Have you noticed that you can set and examine the clipboard contents in JavaScript?

Code:
function SetClipBoard(x) {
   window.clipboardData.setData("text",x);
}


You might be able to use something like this to pass data to/from your applet?

Reply With Quote
  #3  
Old October 17th, 2006, 09:51 AM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2001
Location: Bonita Springs, FL
Posts: 5,654 kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 2 Months 2 Weeks 2 Days 5 h 1 m 44 sec
Reputation Power: 3436
Signing the applet seems to have worked well. Incase anyone wants to know, here's a little .bat file I made which compiles the class, packes it in the archive and signs it. Might be useful to people looking to see how to sign an applet.

Code:
@echo off
echo Cleaning environment...
del *.class
del *.jar
echo Compiling...
javac applet1.java
if not %ERRORLEVEL% == 0 (
	echo Compile failed.
	goto done
)

echo Packaging
jar cvf MyApplet.jar .
echo Signing...
jarsigner MyApplet.jar mykey -keypass abcdef

if %ERRORLEVEL% == 0 (
	echo Running...
	start http://localhost:8008/java/applet1.html
) else (
	echo Signing failed
)


:done


You have to setup the key first, which you can see how to do that from this page in the sun documentation
Comments on this post
tfecw agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Interact with System clipboard from applet.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap