Re: Display an image on a JPanel
Posted by
dscho on
Oct 23, 2013; 2:31pm
URL: http://imagej.273.s1.nabble.com/Display-an-image-on-a-JPanel-tp5005268p5005285.html
Hi Robert,
On Tue, 22 Oct 2013, Robert Lockwood wrote:
> I've an application that collects a monochrome "image" as an array of
> "unsigned short" (short[]), saves it as a TIFF (thanks for that help)
> and displays it on JPanel. I'd rather use the ImageJ methods etc. to
> display the image on the JPanel and reduce my code.
>
> Is this possible? How?
Unfortunately, the ImageCanvas -- ImageJ 1.x' AWT component intended to
display images -- is tightly bound to the ImageWindow class and does not
play well with other components in the same AWT container.
Besides, all the claims that AWT and Swing mix well now seem to be
premature still.
Therefore we integrated Simon Andrews' JImagePanel into Fiji:
https://github.com/fiji/fiji/blob/master/src-plugins/fiji-lib/src/main/java/fiji/util/gui/JImagePanel.javaIt should be relatively easy to integrate into your software: it is
contained in the fiji-lib artifact available at
http://maven.imagej.net/.
You could also extract the file and insert into your own source code, of
course, but you'd ask for diverging versions.
Ciao,
Johannes
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html