Hi All, Hoping someone can help me with this one ...? I need to draw lines with a width greater than 1 and the lengths may be a real value so I am using Line2D.Float. I need to draw exact (calculated)lengths so I am using CAP_BUTT so the line does not have any additional apparent length (the other CAP options have the effect of adding the line width to the line) The problem I am having is that once the line width is set to greater than 1, the lines are actually drawn 1 pixel short. I am sure I am missing soething simple here but have spent a lot of time on it! I know that I can work around it but do I need to, I shouldn't have to + 1 to my line lengths depending on there width? The following demonstrates the problem. I am drawing on a JPanel within a JFrame, JDK/JRE 6, Windows g2.setStroke(new BasicStroke(1,BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL)); g2.setColor(Color.BLACK); g2.draw(new Line2D.Float(20,40,20,75)); // vertical line as marker only // draw 2 lines with line width of 1 g2.setColor(Color.RED); g2.draw(new Line2D.Float(20,60,21,60)); // draws 2 pixel line as expected g2.draw(new Line2D.Float(22,60,23,60)); // draws 2 pixel line as expected ... total of 4 pixels // draw 2 lines with line width of 10 g2.setStroke(new BasicStroke(10,BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL)); g2.setColor(Color.GREEN); g2.draw(new Line2D.Float(20,70,21,70)); // draws 1 pixel only at 20,70 g2.setColor(Color.YELLOW); g2.draw(new Line2D.Float(22,70,23,70)); // draws 1 pixel only at 22,70... so, each line is shortened by 1 pixel // this applies to any line width > 1 Thanks Lew [Message sent by forum member 'aussielew' (aussielew)]
http://forums.java.net/jive/thread.jspa?messageID=291753 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".