Line does not display

Hi all:

I have created a buffered image and trying to draw a line. There is no error message but the line does not display. What am I doing wrong?

BufferedImage bimage =new BufferedImage(300, 400, BufferedImage.TYPE_INT_RGB);

Graphics2D g2bi = bimage.createGraphics();

g2bi.setColor(Color.BLUE);

Line2D.Double line =new Line2D.Double(727432.487,2960594.127,727335.051,2960618.728)

g2bi.translate(727432.487,2960594.127);

g2bi.draw(line);

[554 byte] By [bostonjavaa] at [2007-10-2 21:35:58]
# 1

try taking a look at where you're drawing the line. I think your translation is in the wrong direction, and I think you're trying to translate to accomodate the wrong point.

are you trying to take the point (727432.487, 2960594.127) and translate that to (0, 0)? then the other end of the line would be approx (-97, 22), which would not be in your image. Also, I think the translation of the graphics object needs to be negative (but I'm not positive on that last part). something like this:

translate(-727335.051, -2960594.127).

I beleive that then you will see the line in your image.

- Adam

guitar_man_Fa at 2007-7-14 0:50:05 > top of Java-index,Security,Cryptography...
# 2
Got it.Thanks very much.
bostonjavaa at 2007-7-14 0:50:05 > top of Java-index,Security,Cryptography...
# 3
np. your very welcome.- Adam
guitar_man_Fa at 2007-7-14 0:50:05 > top of Java-index,Security,Cryptography...