Picking in java 2d
问题 I am using java2d to draw a simple graph at the moment I have implemented picking by calling contains(MousePoint) for each object/shape, this works but scales linearly. Is there a more efficient method for picking in java2d? 回答1: Yes, although the full answer would be too long for this space. First of all, unless you have a lot of nodes, then linear will most likely be fine, and you shouldn't change anything unless performance is already seen to suffer. Second, what you want, in general, is