Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / July 2005

Tip: Looking for answers? Try searching our database.

Copy/Paste in an applet under MacOS

Thread view: 
mrjoops - 21 Jul 2005 13:16 GMT
Hi all,

I wrote a text editing applet using a JTextArea or a JTextPane
(depending on what the user wants to write) and until now, all worked
fine (I work in Linux and Windows environment). But last day, I was
asking why the copy/paste didn't work under MacOS.
I first thought the Apple VM was the source of the error, but I was
wrong since a customer lend me a PowerBook to find out what happened.
The installed VM is the Sun one, version 1.4.2_08 (the same is
installed under both Linux and Windows).

So, do I miss something ? Is there a secret option to allow copy/paste
under MacOS ? Or is it an OS bug ?

Thank you for your (numerous, I hope) forthcoming answers.
Andrew Thompson - 21 Jul 2005 13:44 GMT
> I wrote a text editing applet ..

URL?

>..using a JTextArea or a JTextPane
> (depending on what the user wants to write) and until now, all worked
> fine (I work in Linux and Windows environment). But last day, I was
> asking why the copy/paste

Is it signed?

>..didn't work under MacOS.

SecurityExceptions?

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
In Hypno-Vision

mrjoops - 21 Jul 2005 14:25 GMT
> URL?

I can't, it's on a customer's website and htaccess protected

> Is it signed?

As far as I know, I suppose it's not, since I didn't do anything for

> SecurityExceptions?

Actually, I didn't manage to open the Java console in Safari... :-(
Thomas Hawtin - 21 Jul 2005 14:38 GMT
>>Is it signed?
>
> As far as I know, I suppose it's not, since I didn't do anything for

To be clear, is this a java.awt.TextField/TextArea?

Sun's implementation of these classes allow ^C, ^X, and ^V to operate,
but prohibit their simulation from the applet. Apple may not support
that feature. Perhaps you can do something with JavaScript.

It's a pity applets do not support javax.jnlp.

Tom Hawtin
Signature

Unemployed English Java programmer

mrjoops - 21 Jul 2005 14:58 GMT
To be clear, it is javax.swing.JTextArea/JTextPane

I hope I won't have to use JavaScript, cause it's already a JS-bloated
applet ;-)
mrjoops - 21 Jul 2005 14:53 GMT
I finally found how to open the Java console, unfortunately, there
isn't any exception throwed.
The console is empty, free from any error informations (I should feel
happy, instead I feel a bit disappointed)
Andrew Thompson - 21 Jul 2005 14:59 GMT
> I finally found how to open the Java console, unfortunately, there
> isn't any exception throwed.

Really?
<http://www.physci.org/codes/javafaq.jsp#stacktrace>

Where is your (short) code that shows how you are doing it?
<http://www.physci.org/codes/sscce.jsp>

Where's the URL?  Oh ..wait.

>> URL?

> I can't, it's on a customer's website and htaccess protected

Well, drag it out to a public site.. (read the SSCCE document carefully)

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Beats A Hard Kick In The Face

mrjoops - 21 Jul 2005 15:15 GMT
About stacktrace, you know, I already a die-hard fan of the
e.printStackTrace() method, but there isn't really any exception
throwed.

Here is an usable URL :
http://demo30.point52.com/admin/form_article.php?action=mod&id=4&id_gal=0&num_pa
ge=1&od=0

 
login: demo
password: demo
Andrew Thompson - 21 Jul 2005 15:56 GMT
> Here is an usable URL :
> http://demo30.point52.com/admin/form_article.php?action=mod&id=4&id_gal=0&num_pa
ge=1&od=0

>    
> login: demo
> password: demo

'usable' is one word for it - but not one I would use.

I want to validate your applet page before proceeding.

After fighting through the login(?!?) and selecting
a drop down from the list then clicking one of the buttons
with text in French(?) I have yet to see any applet (or
object) tags.

If you want further help from me, put the effort in to prepare an
SSCSE[1], and give us an URL for the *applet* (not some friggin'
selector/nav page) where we (& the W3C validator) can *see* it.

[1] <http://www.physci.org/codes/sscce.jsp>

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Too Hot For Radio

mrjoops - 21 Jul 2005 16:36 GMT
Here is a corrected, in english, URL : (login & password are the same
than above)

http://demo30.point52.com/admin/form_article.php?action=mod&id=5&id_gal=0&num_pa
ge=1&od=0


Pass through the first page by clicking on the "Next" button, the
applet is on the second page.

I'm working and a SSCCE but don't expect it before tomorrow.
mrjoops - 22 Jul 2005 14:45 GMT
Finally, here is the SSCCE (you can test it on
http://www.point52.com/test/)  :

import java.awt.BorderLayout;
import javax.swing.JApplet;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;

public class MyTextArea extends JApplet {

   private JScrollPane scp;
   private JTextPane txa;

   public void init() {
       getContentPane().setLayout(new BorderLayout());

       txa = new JTextPane();
       txa.setEditable(true);

       scp = new JScrollPane();
       scp.setViewportView(txa);
       getContentPane().add(scp, BorderLayout.CENTER);
   }
}
mrjoops - 22 Jul 2005 14:50 GMT
Sorry, the ending } is missing
Andrew Thompson - 22 Jul 2005 15:01 GMT
> Finally, here is the SSCCE (you can test it on
> http://www.point52.com/test/)  :

Now that's what I call an SSCCE..

Now, to get back to what Thomas mentioned..

"Sun's implementation of these classes allow ^C, ^X, and ^V to operate,
but prohibit their simulation from the applet. Apple may not support
that feature."

I suspect that is it.

Anybody got a Mac Java'd browser can check it?

[ It copies just fine from both Sun Java'd Mozilla
and IE on Windows, but that is hardly relevant. ]

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
LIVE From Omicron Persei 8

Steve W. Jackson - 22 Jul 2005 17:53 GMT
> > Finally, here is the SSCCE (you can test it on
> > http://www.point52.com/test/)  :
[quoted text clipped - 13 lines]
> [ It copies just fine from both Sun Java'd Mozilla
> and IE on Windows, but that is hardly relevant. ]

I've tried it in Safari 2.0 and in Firefox 1.0.6 under Mac OS X 10.4.2
with Java 1.4.2_08.  It works just as I expected -- no cut/copy/paste
actions are taken.  I'm reasonably sure that interacting with the system
clipboard in an unsigned applet isn't supposed to be possible.

Just to be clear, Apple's Java should *not* behave differently from
Sun's, overall.  <http://www.apple.com/macosx/features/java/> tells
about it (with marketing-oriented emphases, of course), but it's
supposed to be as close to Sun's own implementation as possible, with
some adjustments to suit the Mac OS X environment and the UI
expectations of Mac users.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

Andrew Thompson - 24 Jul 2005 19:50 GMT
> I've tried it in Safari 2.0 and in Firefox 1.0.6 under Mac OS X 10.4.2
> with Java 1.4.2_08.  It works just as I expected -- no cut/copy/paste
> actions are taken.  

Thanks Steve.  I take it, from the OP's silence, that
effectively answers the question.

Signed applet and programmatic cut/paste might be the only
way to go with Mac OS.  ..Unles the OP wants to experiment
with an AWT *TextArea*.  Might that work?

Signature

Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
You Can't Prove It Won't Happen

Steve W. Jackson - 27 Jul 2005 16:22 GMT
> > I've tried it in Safari 2.0 and in Firefox 1.0.6 under Mac OS X 10.4.2
> > with Java 1.4.2_08.  It works just as I expected -- no cut/copy/paste
[quoted text clipped - 6 lines]
> way to go with Mac OS.  ..Unles the OP wants to experiment
> with an AWT *TextArea*.  Might that work?

Wow...too long since I checked these groups...

I've never done any AWT or applet work.  But I may be a bit confused
anyway.  I thought I understood that the proper behavior of an applet
that's not signed was to prohibit access to the *system* clipboard as a
security measure.  If so, then any automatic behavior of appropriate
keyboard equivalents would be non-functional on Mac OS X and other
platforms (i.e., Windows with Sun's implementation).  But I didn't check
the behavior of that applet on my work Windows XP system...

In any case, Apple's states that its Java implementation meets Sun's
requirements.  If Sun calls for unsigned applets being restricted from
system clipboard access, then (barring a bug) it should behave that way.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

mrjoops - 27 Jul 2005 17:58 GMT
Thank you for your numerous answers

I haven't try to sign my applet but anyway I agree with you Steve about
Apple statement. It should behave the same way.

For the moment, if the copy/paste functionality doesn't work, the
drag'n'drop does. Weird isn't it ?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.