U
umerkle
Hello,
i'm trying to print from my applet under Lotus Notes. There is a
JavaScript function that calls
the applet's print-method which looks like that:
public void printApplet () {
//Panel printPanel = new Panel();
Panel printTitlePanel = new Panel();
Panel printTitle = new Panel();
Color oldColor;
Color oldForeground;
Font oldFont;
Frame frame = new Frame(TransStrings.printDialog);
Properties printprefs = new Properties();
Toolkit toolkit = this.getToolkit();
try{
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPrintJobAccess();
security.checkPropertiesAccess();
security.checkTopLevelWindow(frame);
}
}catch(SecurityException e){
e.printStackTrace();
return;
}
PrintJob job = null;
try{
job = toolkit.getPrintJob(frame, TransStrings.printDialog,
printprefs);
}catch(Exception e){
e.printStackTrace();
}
if (job == null)
return;
printTitlePanel.setBackground(Color.white);
oldColor = this.getBackground();
this.setBackground(Color.white);
oldForeground = this.getForeground();
this.setForeground(Color.black);
oldFont = this.getFont();
this.setFont(new Font("Helvetica", Font.PLAIN,10));
Graphics g = job.getGraphics();
if (g != null) {
g.translate(25, 25);
Dimension size = this.getSize();
PlanerOptions.planer.add(printTitlePanel,"PRINT");
PlanerOptions.planer.doLayout();
PlanerOptions.planer.repaint();
if (PlanerOptions.ONEUSERMODE) {
g.setClip(0, 0, PlanerOptions.rowDescrWidth +
(32*PlanerOptions.xDist),
size.height);
}
else {
g.setClip(0, 0, size.width, size.height);
}
if(PlanerOptions.bShowMessages)
System.out.println("--> Druck!");
this.printAll(g);
PlanerOptions.planer.remove(printTitlePanel);
PlanerOptions.planer.doLayout();
PlanerOptions.planer.repaint();
g.dispose();
}
job.end();
this.setBackground(oldColor);
this.setForeground(oldForeground);
this.setFont(oldFont);
}
under R5 with JDK 1.1 everything is OK, but under R6 with JDK 1.3.x
the system hangs while calling job = toolkit.getPrintJob(frame,
TransStrings.printDialog, printprefs)
Are there any differences in this function between JDK 1.1 and 1.3 ? What
is wrong with my code ?
Uwe
i'm trying to print from my applet under Lotus Notes. There is a
JavaScript function that calls
the applet's print-method which looks like that:
public void printApplet () {
//Panel printPanel = new Panel();
Panel printTitlePanel = new Panel();
Panel printTitle = new Panel();
Color oldColor;
Color oldForeground;
Font oldFont;
Frame frame = new Frame(TransStrings.printDialog);
Properties printprefs = new Properties();
Toolkit toolkit = this.getToolkit();
try{
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkPrintJobAccess();
security.checkPropertiesAccess();
security.checkTopLevelWindow(frame);
}
}catch(SecurityException e){
e.printStackTrace();
return;
}
PrintJob job = null;
try{
job = toolkit.getPrintJob(frame, TransStrings.printDialog,
printprefs);
}catch(Exception e){
e.printStackTrace();
}
if (job == null)
return;
printTitlePanel.setBackground(Color.white);
oldColor = this.getBackground();
this.setBackground(Color.white);
oldForeground = this.getForeground();
this.setForeground(Color.black);
oldFont = this.getFont();
this.setFont(new Font("Helvetica", Font.PLAIN,10));
Graphics g = job.getGraphics();
if (g != null) {
g.translate(25, 25);
Dimension size = this.getSize();
PlanerOptions.planer.add(printTitlePanel,"PRINT");
PlanerOptions.planer.doLayout();
PlanerOptions.planer.repaint();
if (PlanerOptions.ONEUSERMODE) {
g.setClip(0, 0, PlanerOptions.rowDescrWidth +
(32*PlanerOptions.xDist),
size.height);
}
else {
g.setClip(0, 0, size.width, size.height);
}
if(PlanerOptions.bShowMessages)
System.out.println("--> Druck!");
this.printAll(g);
PlanerOptions.planer.remove(printTitlePanel);
PlanerOptions.planer.doLayout();
PlanerOptions.planer.repaint();
g.dispose();
}
job.end();
this.setBackground(oldColor);
this.setForeground(oldForeground);
this.setFont(oldFont);
}
under R5 with JDK 1.1 everything is OK, but under R6 with JDK 1.3.x
the system hangs while calling job = toolkit.getPrintJob(frame,
TransStrings.printDialog, printprefs)
Are there any differences in this function between JDK 1.1 and 1.3 ? What
is wrong with my code ?
Uwe