@Override public void setActive(final boolean activeBool) { try { if (active != activeBool) { // log.debug("setActive called with " + activeBool + " so will change state.."); active = activeBool; if (!active) { // log.debug("Removing current wire in "); table.remove(currentWireImage); table.repaint(currentWireImage.getBounds()); currentWireImage.setWirePosition(null, null); } else { // log.debug("Adding current wire in "); currentWireImage.setWirePosition(sourceLocation, curMousePosition); table.setLayer(currentWireImage, LayeredPaneDndTable.LPT_DRAGGEDWIRE_LAYER); table.add(currentWireImage); table.repaint(currentWireImage.getBounds()); } } } catch (final Exception e) { final String msg = "Exception caught setting wire drag hint active: " + e.toString(); log.error(msg, e); } }
@Override public void signalAnimation() { try { // If the positions are different to when we last generated the wire image, regenerate it and // request a repaint if (curMousePosition != previousMouseLocation || sourceLocation != previousSourceLocation) { if (active) { // log.debug("Animation noticed a movement - will update current wire"); currentWireImage.setWirePosition(sourceLocation, curMousePosition); previousMouseLocation = curMousePosition; previousSourceLocation = sourceLocation; currentWireImage.repaint(); } } } catch (final Exception e) { final String msg = "Exception caught setting wire drag hint active: " + e.toString(); log.error(msg, e); } }