96a97,97 > super.mouseDown(e,x,y); 96,96c96,96 < public void mouseDown(MouseEvent e, int x, int y) --- > public void mouseDown(MouseEvent e, int x, int y) { 97,97d96 < { 104,104d103 < Point p = new Point(ex, ey); 105a105,106 > getConnection().startPoint(ex, ey); > getConnection().endPoint(ex, ey); 106,107d104 < getConnection().startPoint(p.x, p.y); < getConnection().endPoint(p.x, p.y); 111a111,112 > // Since we can't connect to the figure, see if its a Connection > // object we can modify the appearance of. 179,179c180,180 < getTargetFigure().connectorVisibility(false); --- > getTargetFigure().connectorVisibility(false, null); 198a200,204 > * 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. 199,199d199 < * Finds a connectable figure target. 218a224,226 > FigureEnumeration fe = drawing.figuresReverse(); > while (fe.hasNextFigure()) { > Figure figure = fe.nextFigure(); 219,221d223 < Enumeration k = drawing.figuresReverse(); < while (k.hasMoreElements()) { < Figure figure = (Figure) k.nextElement(); 230,230c235,235 < 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). 245,245c257,257 < c = findSource(x, y, drawing()); --- > c = findSource(x, y, getActiveDrawing()); 248,248c260,260 < 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. > */ 254,254c273,273 < getTargetFigure().connectorVisibility(false); --- > getTargetFigure().connectorVisibility(false, null); 258,258c277,277 < 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. 269a291,291 > // Clean up the view. 270,270c292,292 < view().checkDamage(); --- > getActiveView().checkDamage(); 273,273c295,295 < private Connector findConnector(int x, int y, Figure f) { --- > protected Connector findConnector(int x, int y, Figure f) { 287a310,314 > /** > * Returns the topmost? figure that can connect and is at the current mouse > * location. > */ > protected Figure findConnectableFigure(int x, int y, Drawing drawing) { 288,288d309 < private Figure findConnectableFigure(int x, int y, Drawing drawing) { 289,289c315,315 < FigureEnumeration k = drawing.figuresReverse(); --- > FigureEnumeration fe = drawing.figuresReverse(); 289a316,316 > while (fe.hasNextFigure()) { 290,290d315 < while (k.hasMoreElements()) { 291,291c317,317 < Figure figure = k.nextFigure(); --- > Figure figure = fe.nextFigure(); 300,300c326,326 < private void setStartConnector(Connector newStartConnector) { --- > protected void setStartConnector(Connector newStartConnector) { 308,308c334,334 < private void setEndConnector(Connector newEndConnector) { --- > protected void setEndConnector(Connector newEndConnector) { 316,316c342,342 < private void setTargetConnector(Connector newTargetConnector) { --- > protected void setTargetConnector(Connector newTargetConnector) { 324,324c350,350 < private void setTargetFigure(Figure newTarget) { --- > protected void setTargetFigure(Figure newTarget) { 340,340c366,366 < private void setAddedFigure(Figure newAddedFigure) { --- > protected void setAddedFigure(Figure newAddedFigure) { 379,379c405,405 < while (fe.hasMoreElements()) { --- > while (fe.hasNextFigure()) { 406,406c432,432 < private void setConnection(ConnectionFigure newConnection) { --- > protected void setConnection(ConnectionFigure newConnection) {