Using Locators
Locators are used to represent positions on figures. They are useful
for defining where handles or connectors should be placed on a figure.
The Locator interface is implemented by AbstractLocator which in
turn defines two subclasses, OffsetLocator and RelativeLocator.
Relative Locator is used to represent positions relative to a figures
boundary. Positions are specified as percentages of the figure (i.e. 50%
along and 50% down will locate the centre of the figure). Relative Locator
comes with a set of convenient static methods that specify the ‘compass
points’ on a figure (i.e. northWest()
specifies the top left hand corner of a figure etc.)
Offset Locator is used to specify a position relative to another locator. They are often used in conjunction with relative locators for example; to specify a point a few pixels off of the centre of a figure.
© Douglas Kirk Department of Computer and Information Sciences University of Strathclyde, Glasgow.