Forward event to all components JAVA

后端 未结 4 570
天涯浪人
天涯浪人 2021-01-15 21:01

i dont how to solve this problem. I am developing a graphical editor, where arc(line) drawing is possible. I manually set the size of arc component to 1000x1000, so i dont

4条回答
  •  情深已故
    2021-01-15 21:24

    I solved it like this:

    1. save all created arcs to the List
    2. when mouse clicked, loop through all the arcs
    3. create new Line2D object, with the parameters of the arc saved in the list, like this:

      Line2D line = new Line2D.Double(...)

    4. check this condition

      if (line.ptLineDist(x, y) < 3) { ... //we clicked on the line, do something

      }

提交回复
热议问题