but if I use Line2D instead, it doesn't enclose any area.
Use a Path2D
or a Polygon
that has a (very thin) width. It will look like a line, but have an area.
Then use it in the code seen in this answer.
Domanda
I have a space with bouncing balls, and when i drag mouse I want a line to be drawn in it so that balls start bouncing from it as well.
Is there a way/best way to deal with it?
Soluzione
but if I use Line2D instead, it doesn't enclose any area.
Use a Path2D
or a Polygon
that has a (very thin) width. It will look like a line, but have an area.
Then use it in the code seen in this answer.