Suppose I have a graph consisting of nodes and edges, and I want to draw it in a Swing application. I'm not a Swing programmer, but as far as I know, I see two approaches:
- draw the entire graph as a component
- draw each node and edge as one component
I saw an application running the first. To drag a node drawn as a circle, the application checks that it is the closest node to the clicked point. It seems to me that this is not so effective. Is there a second approach? And what should be followed and why?
source
share