2

I am trying to draw rounded diagonal lines in Java using the ACM library.

A very complicated method would involve drawing a diagonal line, scaling it up to increase its width, drawing an arc on the top of that line with respect to the angles it is rounded.

Robin Green
  • 32,079
  • 16
  • 104
  • 187
ahtmatrix
  • 539
  • 1
  • 7
  • 19

2 Answers2

0

From the picture you linked to, it looks like you want lines with round end-caps, sometimes called line-joins. I don't know the ACM library too well, but looking at the docs for it, it seems like you could achieve that look by using a GPen with an image that is just a filled-in circle. You could call the setLocation(x,y) and then drawLine(dx, dy) methods on it.

user1118321
  • 25,567
  • 4
  • 55
  • 86
0

I've never used ACM but looking at the javadoc you might want to consider using shapes rather then lines. So for example, you can draw a rectangle of width using GPolygon then draw circles on the ends using GOval

So something like: draw a polygon around the points [100,0],[0,100],[10,110],[110,10], then draw two circles of size 10 at 0,110 and 110,0. If those shapes are all filled with the same color, they should look like one solid.

Chad Okere
  • 4,570
  • 1
  • 21
  • 19