Ben Ben -4 years ago 98
Java Question

Draw a straight line with java's graphic class

I need to draw a line from two points and what I did so far is using

. But what I want to do is draw a line that intersects with these two points

I don't want to just draw a line between them, here's an image of what I have and what I want to do:

Line Drawings

Answer Source

you could use some mathematik. get the increase of your line. You should know the function

f(x) = mx + b. With your two points,which you allready got, you can calculate two other Points at the Border of your frame, and draw a line between them

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download