IE won't show applet in print preview

K

KenH

Is there something about Swing that Internet Explorer doesn't like?
Before I started using it in my applet I could print the page through
IE, but now the applet just shows up as blank in the preview and if you
print.
 
A

Andrew Thompson

K

KenH

Yes. It is very frustrating. I'm just banging my head trying to create
an idiot-proof printing process for this applet.
 
A

Andrew Thompson

Yes. It is very frustrating. ..

It is very frustrating you dropping out of conversations
that are not going the way you like.

Do you expect me to re-ask the questions I asked before,
or are you hoping they will just go way? Do you think
the answers may have changed in the last ..22 hours?

You still have not provided an URL or example code.

What do you expect us to do to resolve your problem,
guess randomly?

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Don't just take me for tryin' to be heavy. Understand, it's time to get
ready.."
Stevie Ray Vaughan and Double Trouble 'Couldn't Stand The Weather'
 
K

KenH

I need to print in different applets so I wrote a separate class. I
call that class in the routine that hanldles button and keyboard
events. This is the code that captures the applet print button being
pressed. It works perfectly:

// figure out what kind of action happened (keyboard button pressed,
button clicked)
public void actionPerformed(ActionEvent ae) {
String str = ae.getActionCommand();
double n, m;
displayPrint p = new displayPrint();
String tl;
...
other events are handled
...

// process Print button if pressed
if (str.equals("Print")) {
// turn off double buffering to get a high-res print
dbuffering = false;

p.FORMAT = "LANDSCAPE";
p.printComponent(this);

// turn on double buffering
dbuffering = true;
}
repaint();
}

------------------------------------------------------------------------------------------------
This is the code that I call from a javascript function. It does NOT
work:

// print method activated by external code, usually a javascript
function
public void remotePrint() {
displayPrint p = new displayPrint();

// turn off double buffering to get a high-res print
dbuffering = false;

p.FORMAT = "LANDSCAPE";
p.printComponent(this);

// turn on double buffering
dbuffering = true;

repaint();
}

I'm not 'swallowing' exceptions...the console shows nothing and I don't
catch exceptions and do nothing with them. The Java dialog box actually
comes up warning me that the applet is trying to print something (which
is what is does when I print from the button on the applet.)

Below is the code for the button in the HTML. It calls the method that
does not work:

<input class="flatbutton" onclick="document.applets(0).remotePrint();"
type="button" value="Print" name="cpy">
 
T

Thomas Hawtin

KenH said:
This is the code that I call from a javascript function. It does NOT
work:

// print method activated by external code, usually a javascript
function
public void remotePrint() {

I've not done any Java/JavaScript mixing. It might be useful to check
that you are in the AWT Event Dispatch Thread, using
EventQueue.isDispatchThread(). Perhaps use
EventQueue.invokeLater/javax.swing.Timer to make things as absolutely
similar as possible.

Tom Hawtin
 
K

KenH

I think you hit on somethig.

I did a like more digging and found another news thread that alluded to
a some kind of thread issue. Not completely sure why this works but the
method:

// fake a button push to start the print job
public void remotePrint () {
Runnable doClick = new Runnable() {
public void run () {
print_bt.doClick();
}
};
// pretend user clicked your own button.
SwingUtilities.invokeLater(doClick);
}

worked! Basically I'm faking pushing the Print button on the applet,
which runs the method that DOES work.
 

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,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top