-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2
-
x86
-
windows_98
Name: mc57594 Date: 11/21/99
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
printing a concept map (consists of nodes and links)works fine in NT4.0 machine
but give a "caused an exception IOH on module JVM.DLL at 0177:504dcbf6" error.
code call printing:
public void run() {
MapView view=(MapView)getDesktop().getMapView ();//MapView:view is the
//printable
PageFormat pf=new PageFormat();
PrinterJob pj=PrinterJob.getPrinterJob();
pj.setPrintable(view,pf);
if( pj.printDialog()){
Cursor cursor = view.getCursor();
try{
view.getController().stopBlinkingTextCursor();
view.setDoubleBuffering(false);
view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
view.getToolkit().sync();
pj.print();
}catch (Exception PrintException) {
ServerSingleton.log(PrintException);
} finally{
//Get rid of the print Job Object.
if (pj != null)
pj=null;
view.setCursor(cursor);
view.getToolkit().sync();
view.setDoubleBuffering(true);
view.getController().resumeBlinkingTextCursor();
}
}
}
print method in MapView:
public int print(Graphics g, PageFormat pf, int pageIndex) throws
PrinterException {
//find the area that actually has the objects.
if(m_mapBounds==null){
m_mapBounds = getMinBoundingRect();
}
//get the label that should be the title of this page
if(m_pageLabel==null){
getPageLabel();
}
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
//get footer height
int fontHeight=g2.getFontMetrics().getHeight();
// int fontDesent=g2.getFontMetrics().getDescent();
//calculate the total num of pages
//the paper size
double height=pf.getImageableHeight()-fontHeight;
double width=pf.getImageableWidth()+60;
//the columns
int nw=(int)Math.ceil(m_mapBounds.width/width);
//the rows
int ny=(int)Math.ceil((m_mapBounds.height)/height);
int totalPages=nw*ny;
//start to render the pages
if(pageIndex>=totalPages) {
return NO_SUCH_PAGE;
}
// g2.translate(pf.getImageableX(),pf.getImageableY());
//this section'postiton, index from 0
int rowIndex=(int)Math.floor(pageIndex/nw);
int colIndex= pageIndex-nw*(rowIndex);
//draw footer
String footer=m_pageLabel+": page "+ (rowIndex+1)+"-"+(colIndex+1);
g2.drawString(footer,
(int)width/2-g2.getFontMetrics().stringWidth(footer)/2,
(int)(height+fontHeight)+15);//bottom center
//draw the map area
//clip a section from map
//set the beginning position
g2.translate(-m_mapBounds.x,-(m_mapBounds.y));
g2.translate(-colIndex*width,-rowIndex*height);
//clip the section
int sx=(int)Math.ceil(m_mapBounds.x+colIndex*width);
int sy=(int)Math.ceil(m_mapBounds.y+height*rowIndex);
int rx=(int)Math.ceil(width);
int ry=(int)Math.ceil(height);
g2.setClip (sx,sy,rx,ry);
paint (g2);
return Printable.PAGE_EXISTS;
}
the paint method will cause all the components (nodes and links on the map
(inside the clip error)to paint)
(Review ID: 97234)
======================================================================
From: "Holly Q. Li"
To: "Mark Chamness"
Subject: RE: java bug 4293262 - printing
Date: Tue, 23 Nov 1999 14:17:50 -0700
1) My Printable is quite big so I am afraid that I cannot provide you
with a complete runnable code.
2) I have traced the bug to the statement "g2.drawString(..)". (inorder
to draw the page title). Without this statement, the printing method
works fine on both NT and win9x. (somehow, adding a component with label
can be the work arround to this problem, but not all components works).
3) The printer is a HPLaserJet 4000N and the driver is HP LaserJet 4000
Series PCL6.
4) The 1.3 beta works the same way as 1.2.2.
mark.chamness@Eng 1999-11-23
======================================================================
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
printing a concept map (consists of nodes and links)works fine in NT4.0 machine
but give a "caused an exception IOH on module JVM.DLL at 0177:504dcbf6" error.
code call printing:
public void run() {
MapView view=(MapView)getDesktop().getMapView ();//MapView:view is the
//printable
PageFormat pf=new PageFormat();
PrinterJob pj=PrinterJob.getPrinterJob();
pj.setPrintable(view,pf);
if( pj.printDialog()){
Cursor cursor = view.getCursor();
try{
view.getController().stopBlinkingTextCursor();
view.setDoubleBuffering(false);
view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
view.getToolkit().sync();
pj.print();
}catch (Exception PrintException) {
ServerSingleton.log(PrintException);
} finally{
//Get rid of the print Job Object.
if (pj != null)
pj=null;
view.setCursor(cursor);
view.getToolkit().sync();
view.setDoubleBuffering(true);
view.getController().resumeBlinkingTextCursor();
}
}
}
print method in MapView:
public int print(Graphics g, PageFormat pf, int pageIndex) throws
PrinterException {
//find the area that actually has the objects.
if(m_mapBounds==null){
m_mapBounds = getMinBoundingRect();
}
//get the label that should be the title of this page
if(m_pageLabel==null){
getPageLabel();
}
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
//get footer height
int fontHeight=g2.getFontMetrics().getHeight();
// int fontDesent=g2.getFontMetrics().getDescent();
//calculate the total num of pages
//the paper size
double height=pf.getImageableHeight()-fontHeight;
double width=pf.getImageableWidth()+60;
//the columns
int nw=(int)Math.ceil(m_mapBounds.width/width);
//the rows
int ny=(int)Math.ceil((m_mapBounds.height)/height);
int totalPages=nw*ny;
//start to render the pages
if(pageIndex>=totalPages) {
return NO_SUCH_PAGE;
}
// g2.translate(pf.getImageableX(),pf.getImageableY());
//this section'postiton, index from 0
int rowIndex=(int)Math.floor(pageIndex/nw);
int colIndex= pageIndex-nw*(rowIndex);
//draw footer
String footer=m_pageLabel+": page "+ (rowIndex+1)+"-"+(colIndex+1);
g2.drawString(footer,
(int)width/2-g2.getFontMetrics().stringWidth(footer)/2,
(int)(height+fontHeight)+15);//bottom center
//draw the map area
//clip a section from map
//set the beginning position
g2.translate(-m_mapBounds.x,-(m_mapBounds.y));
g2.translate(-colIndex*width,-rowIndex*height);
//clip the section
int sx=(int)Math.ceil(m_mapBounds.x+colIndex*width);
int sy=(int)Math.ceil(m_mapBounds.y+height*rowIndex);
int rx=(int)Math.ceil(width);
int ry=(int)Math.ceil(height);
g2.setClip (sx,sy,rx,ry);
paint (g2);
return Printable.PAGE_EXISTS;
}
the paint method will cause all the components (nodes and links on the map
(inside the clip error)to paint)
(Review ID: 97234)
======================================================================
From: "Holly Q. Li"
To: "Mark Chamness"
Subject: RE: java bug 4293262 - printing
Date: Tue, 23 Nov 1999 14:17:50 -0700
1) My Printable is quite big so I am afraid that I cannot provide you
with a complete runnable code.
2) I have traced the bug to the statement "g2.drawString(..)". (inorder
to draw the page title). Without this statement, the printing method
works fine on both NT and win9x. (somehow, adding a component with label
can be the work arround to this problem, but not all components works).
3) The printer is a HPLaserJet 4000N and the driver is HP LaserJet 4000
Series PCL6.
4) The 1.3 beta works the same way as 1.2.2.
mark.chamness@Eng 1999-11-23
======================================================================
- duplicates
-
JDK-4274071 BeanBox can't load jars and crashes with JDK-1.3fcs-G on Windows 95
- Closed