I am making a basic Java program and I would like to draw a line using basic swing Graphics.drawLine.
Is there a way to make the two points in terms of doubles so I can make the output more accurate, or another way that is better?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can draw the lines using
((Graphics2D) g).draw(Shape)and pass it aLine2D.Double.Here’s a demo:
You might also want to try adding