96,97c96,97 < public void mouseDown(MouseEvent e, int x, int y) < { --- > public void mouseDown(MouseEvent e, int x, int y) { > super.mouseDown(e,x,y); 104d103 < Point p = new Point(ex, ey); 106,107c105,106 < getConnection().startPoint(p.x, p.y); < getConnection().endPoint(p.x, p.y); --- > getConnection().startPoint(ex, ey); > getConnection().endPoint(ex, ey); 111a111,112 > // Since we can't connect to the figure, see if its a Connection > // object we can modify the appearance of. 179c180 < getTargetFigure().connectorVisibility(false); --- > getTargetFigure().connectorVisibility(false, null); 199c200,204 < * Finds a connectable figure target. --- > * Finds a connectable figure target at the current mouse location that can > * 1. Connect to things > * 2. Is not already connected to the current Connection (no self connection) > * 3. The current Connection can make a connection between it and the start > * figure. 219,221c224,226 < Enumeration k = drawing.figuresReverse(); < while (k.hasMoreElements()) { < Figure figure = (Figure) k.nextElement(); --- > FigureEnumeration fe = drawing.figuresReverse(); > while (fe.hasNextFigure()) { > Figure figure = fe.nextFigure(); 230c235 < private void setConnection(ConnectionFigure newConnection) { --- > protected void setConnection(ConnectionFigure newConnection) { 240a246,249 > /** > * Attempts to set the Connector to be connected to based on the current > * location of the mouse. > */ 243a253,255 > // If tool is not actively looking for a target for our current > // Connection, see if there are any connectable figures at at the > // current location(findSource). 245c257 < c = findSource(x, y, drawing()); --- > c = findSource(x, y, getActiveDrawing()); 248c260 < c = findTarget(x, y, drawing()); --- > c = findTarget(x, y, getActiveDrawing()); 251a264,270 > /** > * If the current target is not the stored target then turn off the > * stored targets connectors visibility and turn on the current targets > * connectors visibility. Then set the stored target to the current target. > * If the targets match then don't do anything. > * Note: the target may have more than one connector. > */ 254c273 < getTargetFigure().connectorVisibility(false); --- > getTargetFigure().connectorVisibility(false, null); 258c277 < getTargetFigure().connectorVisibility(true); --- > getTargetFigure().connectorVisibility(true, getConnection()); 261a281,282 > // Since you have a legitimate target, grab its connector and set it as > // the new target connector. 270c291,292 < view().checkDamage(); --- > // Clean up the view. > getActiveView().checkDamage(); 273c295 < private Connector findConnector(int x, int y, Figure f) { --- > protected Connector findConnector(int x, int y, Figure f) { 288,291c310,317 < private Figure findConnectableFigure(int x, int y, Drawing drawing) { < FigureEnumeration k = drawing.figuresReverse(); < while (k.hasMoreElements()) { < Figure figure = k.nextFigure(); --- > /** > * Returns the topmost? figure that can connect and is at the current mouse > * location. > */ > protected Figure findConnectableFigure(int x, int y, Drawing drawing) { > FigureEnumeration fe = drawing.figuresReverse(); > while (fe.hasNextFigure()) { > Figure figure = fe.nextFigure(); 300c326 < private void setStartConnector(Connector newStartConnector) { --- > protected void setStartConnector(Connector newStartConnector) { 308c334 < private void setEndConnector(Connector newEndConnector) { --- > protected void setEndConnector(Connector newEndConnector) { 316c342 < private void setTargetConnector(Connector newTargetConnector) { --- > protected void setTargetConnector(Connector newTargetConnector) { 324c350 < private void setTargetFigure(Figure newTarget) { --- > protected void setTargetFigure(Figure newTarget) { 340c366 < private void setAddedFigure(Figure newAddedFigure) { --- > protected void setAddedFigure(Figure newAddedFigure) { 379c405 < while (fe.hasMoreElements()) { --- > while (fe.hasNextFigure()) { 406c432 < private void setConnection(ConnectionFigure newConnection) { --- > protected void setConnection(ConnectionFigure newConnection) {