diff --git a/src/main/java/net/imagej/ui/swing/viewer/image/AbstractSwingImageDisplayViewer.java b/src/main/java/net/imagej/ui/swing/viewer/image/AbstractSwingImageDisplayViewer.java index 9f7968f5..95c5b418 100644 --- a/src/main/java/net/imagej/ui/swing/viewer/image/AbstractSwingImageDisplayViewer.java +++ b/src/main/java/net/imagej/ui/swing/viewer/image/AbstractSwingImageDisplayViewer.java @@ -35,6 +35,7 @@ import net.imagej.ui.viewer.image.AbstractImageDisplayViewer; import org.scijava.display.Display; +import org.scijava.display.DisplayService; import org.scijava.event.EventHandler; import org.scijava.event.EventService; import org.scijava.options.event.OptionsEvent; @@ -77,6 +78,10 @@ public JHotDrawImageCanvas getCanvas() { @Override public void view(final DisplayWindow w, final Display d) { super.view(w, d); + + // NB: resolve the racing condition when other consumer are looking up the + // active display + getContext().service(DisplayService.class).setActiveDisplay(getDisplay()); dispatcher = new AWTInputEventDispatcher(getDisplay(), eventService);