Hi There,
I'm having some problems printing a
java applet that uses a jar file. I have signed and verified signing
with verisign certificate. When I try to print the applet I get the following error in the IE java console
window:
got frame
com.ms.security.SecurityExceptionEx[testapp/testapp.actionPerformed]
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkPrintJobAccess
at com/ms/awt/WToolkit.getPrintJob
at testapp/testapp.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run
Exception occurred during event dispatching:
com.ms.security.SecurityExceptionEx[testapp/testapp.actionPerformed]
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkPrintJobAccess
at com/ms/awt/WToolkit.getPrintJob
at testapp/testapp.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run
One site I read said that I has to convert my HTML files using Sun's html converter so I tried this
but now when I try to print I the printer dialog box comes up but I get the following error in the Java
console window and a blank page is printed (you can see here it's not even getting the frame)
Exception occurred during event dispatching:
java.lang.NullPointerException
at sun.awt.windows.WGraphics.clone(Unknown Source)
at sun.awt.windows.WPrintGraphics.clone(Unknown Source)
at sun.java2d.SunGraphics2D.create(Unknown Source)
at sun.awt.windows.WPrintGraphics.create(Unknown Source)
at sun.awt.windows.WPrintGraphicsWrapper.create(Unknown Source)
at sun.awt.windows.WPrintJob.getGraphics(Unknown Source)
at testapp.testapp.actionPerformed(testapp.java:52)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Please help!! I have to use 1.1.8 in this example and this code also has to work on the MAC. Am
I going to have to use a Java Plugin and is there one available for the MAC? Any information/help
you can provide will be greatly appreciated. Here is my
test code:
public class testapp extends Applet implements ActionListener {
private Button print;
public void init() {
print=new Button("print");
print.addActionListener(this);
add(print);
}
//get the browser frame (to use as the owner when creating a dialog)
private Frame getBrowserFrame() {
Container c = this.getParent();
while (c != null) {
if (c instanceof Frame) {
System.out.println("got frame");
return((Frame)c);
}
c = c.getParent();
}
return ((Frame)c);
}
public void actionPerformed(ActionEvent e) {
PrintJob pj = getToolkit().getPrintJob(getBrowserFrame(), "printing" , null);
if (pj != null) {
System.out.println("got print job");
Graphics pg = pj.getGraphics();
System.out.println("after got graphics");
if (pg!=null) {
System.out.println("got graphics");
printComponents(pg);
System.out.println("printed components");
pg.dispose();
System.out.println("dispose graphics");
} else {
System.out.println("graphics is null");
}
pj.end();
} else {
System.out.println("printjob is null");
}
System.out.println("ending printing");
}
}
Thanks,
Naomi