Printing in an applet

K

KenH

I have a charting applet that has a print method that works just fine.

My problem is I am trying to initiate the print method from a
javascript routine but it doesn't work.

I access my applet from javascript all the time (feeding data hidden in
a form to the chart), but for some reason trying to launch the printing
from javascript doesn't work. Any ideas? Do I have to set some kind of
focus?
 
A

Andrew Thompson

I have a charting applet ..
URL?

..but for some reason trying to launch the printing
from javascript doesn't work.

It may be Bad Mojo. Or alternately there is a slight chance
there are exceptions or errors listed in the Java or JavaScript
consoles of your browser. But since you did not mention any,
I'm guessing Bad Mojo.
Any ideas?

Security? <http://www.physci.org/codes/javafaq.jsp#security>

[ Read the entire FAQ - lots on applets. ]
 
K

KenH

The applet runs on my company intranet. I check the console when I run
it...no errors in java, and nothing in javascript. I'll look over the
FAQ just the same.
 
A

Andrew Thompson

The applet runs on my company intranet.

You can move it to a free site where we can see
it break, or prepare a simple example that
demonstrates the same behaviour and do the same.

It's up to you.
..I check the console when I run
it...no errors in java,

Do you swallow exceptions? [1]
..and nothing in javascript. I'll look over the
FAQ just the same.

I recommend that. [1] (FAQ mentions swallowing exceptions)
 
R

Roedy Green

I have a charting applet that has a print method that works just fine.

It should not work just fine UNLESS it is signed. Is the problem you
are testing it running it as an application on in Eclipse Appletviewer
where you don't need signing, and now you are running it truly as an
Applet for the first time when you use JavaScript?
 
T

Thomas Hawtin

Roedy said:
It should not work just fine UNLESS it is signed. Is the problem you
are testing it running it as an application on in Eclipse Appletviewer
where you don't need signing, and now you are running it truly as an
Applet for the first time when you use JavaScript?

Not true. Way back in 1998 JRE 1.2 changed the behaviour to pop up a
little window to confirm the print. Just like JNLP, only completely
different.

It gave me a surprise. I found out by testing printing in the applet I
was working on didn't work under the Plug-In. Actually it didn't work.
It deadlocked instead.

I suggest KenH checks to see whether the code execution gets as far as
the print request, and whether it gets any further. Not tried mixing
Java and JavaScript. The only other thing I can think of is the effect
of having the JavaScript handling code with whatever class loader on the
stack while attempting to print.

Tom Hawtin
 
R

Roedy Green

Not true. Way back in 1998 JRE 1.2 changed the behaviour to pop up a
little window to confirm the print. Just like JNLP, only completely
different.

Nowhere does Sun tell you which system properties require signing and
which are safe. I scoured the docs and code to no avail. I compiled a
list by experiment at http://mindprod.com/jgloss/properties.html I
should not have had to do that.

I had to find out by experiment that you can read some files off the
home website but not others in an unsigned Applet.

Now I find out, again indirectly by fluke experiment, that the
printing restriction is gone.
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top