Can't Copy text unless console is opened before applet with JTextField in Sun's JVM

  • Thread starter =?ISO-8859-1?Q?Peter_Valdemar_M=F8rch?=
  • Start date
?

=?ISO-8859-1?Q?Peter_Valdemar_M=F8rch?=

If an applet uses JTextFields, it is impossible to copy text from the
console to the clipboard (or anywhere else) if the console is opened
after the applet.

See http://demo.capmon.dk/~pvm/nocopy/nocopy.html for a working applet
with source and class file to try it out on...

So if something bad has happened, and there are hints in the console
e.g. a stack trace, it all has to be retyped by hand, since all Copy
or export is impossible...

Does anyone know of a workaround for this? I'd like to be able to e.g.
copy stack traces to bug reports.

Try these test cases:

* Close all browser windows. Open a browser and visit this page. After
the page with this applet has loaded, then open the console with
"Tools/Sun Java Console" (or "Tools/Web Development/Java Console" in
Mozilla). Select some text in the console. There is no way to put this
text on the clipboard; the "Copy" button doesn't work, and neither
does CTRL+Insert, CTRL+C or anything else.

* Close all browser windows. Open a browser window no some non-java
page and then open the console with "Tools/Sun Java Console" (or
"Tools/Web Development/Java Console" in Mozilla). Then visit this
page. Select some text in the console. Now the "Copy" button does
work, enabling "export" of e.g. stack traces to other applicaitons
e.g. email.

The difference is which is opened first: The console or the applet. If
you look at the very rudimentary Java source code, it is the mere
creation of a JTextField is what disables or breaks the Copy
functionality.

I've tried this on Windows XP with IE 6.0 and Mozilla 1.3 and they
behave exactly the same. The JVM is Sun's 1.4.2 and I've tried
1.4.1_02 also with the same behavior. I've also tried javac from both
1.4.2 and 1.4.1_01
 
R

Roedy Green

If an applet uses JTextFields, it is impossible to copy text from the
console to the clipboard (or anywhere else) if the console is opened
after the applet.

I the old days you could copy and paste manually to TextFields. How
come not JTextFields?
 
?

=?ISO-8859-1?Q?Peter_Valdemar_M=F8rch?=

Roedy Green said:
I the old days you could copy and paste manually to TextFields. How
come not JTextFields?

I hadn't even noticed that.

Yes, it is impossible to cut or copy from JTextField instances also,
unless the console is opened first.

So now I wonder what sort of magic the console does when initialized
to enable cut'n'paste. Could I do something similar in my
JAppletDerivative.init()?

I've updated http://demo.capmon.dk/~pvm/nocopy/nocopy.html to reflect
the new understanding.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top