Reputation: 4597
I am making my own class diagram app in Swing/AWT but i stopped at this functionality:
A general guideline or a sample code is highly appreciated
Upvotes: 3
Views: 5544
Reputation: 116200
I don't know Java, but the steps you could follow are these:
For the implementation you could build a line class that uses the observer pattern to listen to the two rectangles it follows, so it can update itself whenever one of them moves or resizes.
Upvotes: 5
Reputation: 2777
try creating a class named "ConnectingLine" or similar. this class will then have several segments (that's the name of these line parts in dia, which is currently my favorite uml modeling tool) which will be calculated one by one. you'll have a sepaparate class for this of course ;) called maybe "LineSegment". i think this should make it easier for you to perform the mathematical calculations required to perform this task.
this could also enable making segments "auto routed or not" easy d(^_^)b
Upvotes: -1