Color printouts of Grid.J lose the background colors

Article ID: 1087
Last updated: 01 Feb, 2008
Article ID: 1087
Last updated: 01 Feb, 2008
Revision: 1
Views: 2740
Posted: 12 Mar, 1999
by Dean J.
Updated: 01 Feb, 2008
by Dean J.
Problem


When I make printouts of grids, the background colors that I have set do not appear.


Cause


The colors are being stripped off, since color backgrounds on a black and white printout might not be very attractive.


Action


To change this behavior, you can make the following patch to your source code.

At line 150 of com.roguewave.grid.awt.v2_0.GXLabel.java, change this line in the drawBackground() method:

 if (bColor&&!bPrinting) To: if (bColor || !bPrinting)  

The entire function should look like: protected void drawBackground(Graphics g, int x, int y, int width, int height, GXStyle gxStyle, boolean bErase) { boolean bColor = !grid().getParam().getProperties().getBlackWhite(); Color background = Color.white;

// adjust size. if (!(grid().getDrawVLine())) width++; if (!(grid().getDrawHLine())) height++;

// check if background needs to be drawn if (bErase || !grid().getParam().isTransparentBackground() ) { boolean bPrinting = (g instanceof PrintGraphics); if (bColor || !bPrinting) { if (gxStyle.getIncludeBackground()) background = gxStyle.getBackground(); else background = grid().getBackground(); } else background = Color.white; g.setColor(background); g.fillRect(x, y, width, height); } } < /P >

Rebuild the file.

 

 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 1087
Last updated: 01 Feb, 2008
Revision: 1
Views: 2740
Posted: 12 Mar, 1999 by Dean J.
Updated: 01 Feb, 2008 by Dean J.

Others in this category