Hi all, Couldn't find a specific thread addressing this, so I'll post a new one. It may just be that I am still naive about Java2D...
I have a simple window which renders stuff and draws a grid on top. I've recently added code which renders labels for the grid lines; this works fine, except when the window repaints itself after being obscured or resized; in this case, the horizontal labels always render properly, but the vertical labels (which have an AffineTransform applied) do not (see this image: http://www.typically.net/FTP/2d_grid_bug_all.png ). The code which renders the labels is: [code] double space = grid.getSpacing(); int size = grid.getLabelSize(); Font font = new Font("Courier New", Font.PLAIN, size); Color c = grid.getLabelColour(); g.setColor(c); g.setFont(font); FontRenderContext frc = g.getFontRenderContext(); int margin = 2; int offset = 1; String format = NumberFunctions.getReasonableFormat(space); AffineTransform transform_old = g.getTransform(); for (; x_pos < x_max; x_pos += space){ Point pt = getScreenPoint(new Point2f((float)x_pos, (float)y_min )); pt.y -= margin; pt.x -= offset; TextLayout tl = new TextLayout(arDouble.getString(x_pos, format), font, frc); AffineTransform transform = new AffineTransform(); transform.rotate(-Math.PI / 2.0, pt.x, pt.y); g.setTransform(transform); tl.draw(g, pt.x, pt.y); } g.setTransform(transform_old); for (; y_pos < y_max; y_pos += space){ Point pt = getScreenPoint(new Point2f((float)x_min, (float)y_pos )); pt.x += margin; pt.y -= offset; TextLayout tl = new TextLayout(arDouble.getString(y_pos, format), font, frc); tl.draw(g, pt.x, pt.y); } [/code] Any idea what's going on? [Message sent by forum member 'typically' (typically)] http://forums.java.net/jive/thread.jspa?messageID=338644 =========================================================================== To unsubscribe, send email to lists...@java.sun.com and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to lists...@java.sun.com and include in the body of the message "help".